grep (bash) multi-line pattern

后端 未结 6 394
感情败类
感情败类 2021-01-15 01:14

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]),

6条回答
  •  失恋的感觉
    2021-01-15 02:07

    You can use awk with custom RS:

    awk -v n=2 -v RS='(^|\n)>' 'NR==n+1{print ">" $0}' file    
    >chr2
    TTGNACACCC
    TGGGGGAGTA
    

提交回复
热议问题