次のファイルがあります。
1>>>PROKKA_00001 Transcriptional regulator PadR-like family protein - 137 aa
>>tr|E5G076|E5G076_ARAHY Ara h 1 allergen OS=Arachis hyp (619 aa)
37.3% identity
>>sp|P43238|ALL12_ARAHY Allergen Ara h 1, clone P41B OS= (626 aa)
37.3% identity
>>tr|N1NG13|N1NG13_ARAHY Seed storage protein Ara h1 OS= (626 aa)
37.3% identity
>>tr|Q6PSU6|Q6PSU6_ARAHY Conarachin (Fragment) OS=Arachi (303 aa)
29.4% identity
>>tr|Q6PSU3|Q6PSU3_ARAHY Conarachin (Fragment) OS=Arachi (580 aa)
29.4% identity
>>tr|A5Z1Q5|A5Z1Q5_ARADU Ara d 6 OS=Arachis duranensis O (145 aa)
23.7% identity
>>sp|P43237|ALL11_ARAHY Allergen Ara h 1, clone P17 OS=A (614 aa)
29.4% identity
>>tr|A8VT50|A8VT50_ARADU Conglutin OS=Arachis duranensis (160 aa)
44.8% identity
>>tr|A1YQB2|A1YQB2_BOVIN Alpha lactabumin (Fragment) OS= (52 aa)
50.0% identity
>>tr|A5Z1Q8|A5Z1Q8_ARADU Ara d 2.01 OS=Arachis duranensi (160 aa)
44.8% identity
>>tr|A8VT44|A8VT44_ARADU Conglutin OS=Arachis duranensis (160 aa)
44.8% identity
>>tr|A8VT41|A8VT41_ARADU Conglutin OS=Arachis duranensis (160 aa)
44.8% identity
>>tr|N1NEW2|N1NEW2_ARADU Seed storage protein Ara h1 OS= (614 aa)
29.4% identity
>>tr|B3IXL2|B3IXL2_ARAHY Main allergen Ara h1 OS=Arachis (614 aa)
29.4% identity
>>tr|A8VT50|A8VT50_ARADU Conglutin OS=Arachis duranensis (160 aa)
2>>>PROKKA_00001 Transcriptional regulator PadR-like family protein - 137 aa
>>tr|E5G076|E5G076_ARAHY Ara h 1 allergen OS=Arachis hyp (619 aa)
37.3% identity
>>sp|P43238|ALL12_ARAHY Allergen Ara h 1, clone P41B OS= (626 aa)
37.3% identity
IDが35%以上の行の上の行を検索したいです。予想される出力は次のとおりです。
1>>>PROKKA_00001 Transcriptional regulator PadR-like family protein - 137 aa
>>tr|E5G076|E5G076_ARAHY Ara h 1 allergen OS=Arachis hyp (619 aa)
37.3% identity
>>sp|P43238|ALL12_ARAHY Allergen Ara h 1, clone P41B OS= (626 aa)
37.3% identity
>>tr|N1NG13|N1NG13_ARAHY Seed storage protein Ara h1 OS= (626 aa)
37.3% identity
>>tr|A8VT50|A8VT50_ARADU Conglutin OS=Arachis duranensis (160 aa)
44.8% identity
>>tr|A1YQB2|A1YQB2_BOVIN Alpha lactabumin (Fragment) OS= (52 aa)
50.0% identity
>>tr|A5Z1Q8|A5Z1Q8_ARADU Ara d 2.01 OS=Arachis duranensi (160 aa)
44.8% identity
>>tr|A8VT44|A8VT44_ARADU Conglutin OS=Arachis duranensis (160 aa)
44.8% identity
>>tr|A8VT41|A8VT41_ARADU Conglutin OS=Arachis duranensis (160 aa)
44.8% identity 2>>>PROKKA_00001 Transcriptional regulator PadR-like family protein - 137 aa
>>tr|E5G076|E5G076_ARAHY Ara h 1 allergen OS=Arachis hyp (619 aa)
37.3% identity
>>sp|P43238|ALL12_ARAHY Allergen Ara h 1, clone P41B OS= (626 aa)
37.3% identity
私は次のことを試しましたが、まだ運がありませんでした。
grep -B1 "35\+.*" -e '>>>' file > output_file
助けてくれてありがとう!ありがとうございます!
答え1
数値比較に正規表現を使用しないようにします。繰り返しますが、これは-B
グローバルオプションなので必然的に>>>
。
awkでは、次のことができます。
$ awk '/>>>/ {print} />>tr/ {last = $0} $1+0 >= 35 {print last; print}' file
1>>>PROKKA_00001 Transcriptional regulator PadR-like family protein - 137 aa
>>tr|E5G076|E5G076_ARAHY Ara h 1 allergen OS=Arachis hyp (619 aa)
37.3% identity
>>tr|E5G076|E5G076_ARAHY Ara h 1 allergen OS=Arachis hyp (619 aa)
37.3% identity
>>tr|N1NG13|N1NG13_ARAHY Seed storage protein Ara h1 OS= (626 aa)
37.3% identity
>>tr|A8VT50|A8VT50_ARADU Conglutin OS=Arachis duranensis (160 aa)
44.8% identity
>>tr|A1YQB2|A1YQB2_BOVIN Alpha lactabumin (Fragment) OS= (52 aa)
50.0% identity
>>tr|A5Z1Q8|A5Z1Q8_ARADU Ara d 2.01 OS=Arachis duranensi (160 aa)
44.8% identity
>>tr|A8VT44|A8VT44_ARADU Conglutin OS=Arachis duranensis (160 aa)
44.8% identity
>>tr|A8VT41|A8VT41_ARADU Conglutin OS=Arachis duranensis (160 aa)
44.8% identity
2>>>PROKKA_00001 Transcriptional regulator PadR-like family protein - 137 aa
>>tr|E5G076|E5G076_ARAHY Ara h 1 allergen OS=Arachis hyp (619 aa)
37.3% identity
>>tr|E5G076|E5G076_ARAHY Ara h 1 allergen OS=Arachis hyp (619 aa)
37.3% identity
パーセント文字列変換は、$1 + 0
最小限gawk
でサポートされているようですmawk
。