grep (bash) multi-line pattern

后端 未结 6 475
感情败类
感情败类 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 01:58

    You should install the FAST perl package. It contains many utilities directly usable from the shell for dealing with fasta files, like fashead or fastail (and much more)

    after installing it is simple as:

    fashead -n2 fastafile | fastail -n1
    

    output

    >chr2
    TTGNA.....
    

    or even simpler

    fasgrep chr2 fastafile
    

    with the same output...

提交回复
热议问题