mercredi 25 février 2015

Using grep in shell script


I have a text file which looks like this(I am showing few lines of it)



INDEX : 1
snRNA_seq:TTTTGGAGCAGGGAGATGGAAT

miRNA_seq:CTCCTGACTCCAGGTCCTGTGT

target: RNU2-1,RNU2-64P,RNU2-37P,RNU2-61P,RNU2-68P,RNU2-26P,RNU2-57P,RNU2-59P
length: 22
miRNA: hsa-miR-378a-5p*MI0000786
length: 22


mfe: -21.3 kcal/mol

p-value: 0.015469



position 1

target 5' U A 3'

UUUGGAG CAGGG

GGACCUC GUCCU

miRNA 3' UGUGUCCU A C 5'





INDEX : 10
snRNA_seq:TTGGAGCAGGGAGATGGAAT

miRNA_seq:ATCCTCTCTTCCCTCCTCCCAG

target: RNU2-1,RNU2-64P,RNU2-37P,RNU2-61P,RNU2-68P,RNU2-26P,RNU2-57P,RNU2-59P
length: 20
miRNA: hsa-miR-7111-3p*MI0022962
length: 22


mfe: -24.0 kcal/mol

p-value: 0.001695



position 2

target 5' U C U A 3'

GGAG AGGG AGA GGA

CCUC UCCC UCU CCU

miRNA 3' GAC C U CU A 5'


I have list of identifiers namely 1,10,20,30 etc This identifier in the above file is right next to INDEX part. All I want to do is if the identifier matches the above file print that line + next 28 lines basically some thing like this grep -A 28 "INDEX : identifier"


How can i do this in shell??


Regards



Aucun commentaire:

Enregistrer un commentaire