In bash (4.3.46(1)) I have some multi-line so called fasta records where each record is initiated by on line with >name and the following lines DNA sequence ([AGCTNacgtn]),
The best tool for working with multi-line records is awk
.
In your case:
awk 'BEGIN{RS=">"} NR==2 {print RS$0}' input.txt
>chr1
AGCTACTTTT
AGGGNGGTNN
>chr2
TTGNACACCC
TGGGGGAGTA
>chr3
TGACGTGGGT
TCGGGTTTTT
BEGIN{RS=">"}
Initially set record separator to ">"
NR==2
filter for record #2 only
{print RS$0}
print record #2 with the missing record separator back