RegExを使った最後のゲーム

RegExを使った最後のゲーム

grep -oP '(?<=%28).*?(?=%29)' f.txt次の行でやる

chr01_pilon_pilon   gmap-gsnap  mRNA    55846944    55847057    .   +   .   ID=NbD052382.1.mrna1;Name=NbD052382.1;Note=cytochrome b6/f complex subunit V %28plastid%29  %28NP_054520.1%29;Parent=NbD052382.1.path1;coverage=100.0;identity=100.0;indels=0;matches=114;mismatches=0;unknowns=0

わかりましたplastid%29 %28NP_054520.1%29。どのように最後のゲームしか受けられませんかNP_054520.1

事前にありがとう

ベストアンサー1

\K振り返ると、貪欲な(「左のまま」)アサーションに置き換えることができます。

$ grep -oP '.*%28\K.*?(?=%29)' f.txt
NP_054520.1

おすすめ記事