W
W
wolverine7772019-10-29 01:29:34
linux
wolverine777, 2019-10-29 01:29:34

How to grep on a line that contains a semicolon; ?

Hello, I need to "grab" from such a line

ID=PMZ_0036570;Dbxref=InterPro:IPR000175,PANTHER:PTHR11616,PANTHER:PTHR11616:SF125,Pfam:PF00209,ProSiteProfiles:PS50267,SUPERFAMILY:SSF161070;Name=Slc6a18;desc=Sodium-dependent

a section called Name=blablabla (in this particular case - Name=Slc6a18)
I get the above line using and then I try to do
awk '{print $9}' PPP_genes.gff3.txt | head -3
awk '{print $9}' PPP_genes.gff3.txt | head -3 | grep "Name=" PPP_genes.gff3.txt

and nothing comes out .. I
tried to do it cut -d; -f 3(this is the 3rd column) - I get an error, they say -d does not understand the semicolon ...
In general, I may have done something, but I just need to "grab" this from each line here is the very Name.
Tell me, please, how to do it?
Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey c0re, 2019-10-29
@wolverine777

  • awk '{print $9}' PPP_genes.gff3.txt | head -3 | cut -d";" -f 3

  •  &&
        echo ${BASH_REMATCH[1]}

K
ky0, 2019-10-29
@ky0

Compose a regexp starting with Name=and ending with a semicolon. What's in the middle - and pull out.
https://regex101.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question