I am trying to filter lines from a text file based on patterns in proceeding lines which keeping the pattern matched line. I also need to rename the pattern matched files
for example:
>text chr1
AAA
BBA
AAA
>additional text chr2
ABA
AAA
CCC
TTT
>some text chr3
TTT
CCC
TCT
>no good text 1 3
AAA
CCC
TCT
>unimportant text 2 3 3
ACC
CCC
TCT
the command would print the lines containing "chr" and all following lines until a line beginning with ">" does not contain "chr":
>chr1
AAA
BBA
AAA
>chr2
ABA
AAA
CCC
TTT
>chr3
TTT
CCC
TCT
chr1
), and - remove integer numbers after\>
?