This might be easy but I have not been able to solve it - I have a normal fasta file as below:

```
>seq1
ATCTAC
>seq2
AATCGCATCG
>seq3
ATATACAGC
>seq1
ATCGCGGGC
>seq4
ATTAATTTTAT
```

what I want o do is to reverse the order of lines in the file. So the desired output should be:

```
>seq4
ATTAATTTTAT
>seq1
ATCGCGGGC
>seq3
ATATACAGC
>seq2
AATCGCATCG
>seq1
ATCTAC
```

I tried using ```tail -r file.fa``` but then it does not work because ids get placed after the sequences.

How can I do this?

Thank you
    awk '/^>/ {printf("%s%d\t%s\t",(N>0?"\n":""),N,$0);N++;next;} {printf("%s",$0);} END {printf("\n");}' < input.fasta  | sort -t $'\t' -k1,1nr | cut -f 2- | tr "\t" "\n"