我想从我的文件中提取信息并将其保存在单独的文件中。
输入文件如下所示:
>Feature NODE_18_1000_cov_1.366138
1 888 CDS
db_xref COG:COG3385
inference ab initio prediction:Prodigal:2.6
inference similar to AA sequence:ISfinder:ISPg4
locus_tag LFHBJEGH_33517
product IS4 family transposase ISPg4
>Feature NODE_18222_1000_cov_1.310053
665 330 CDS
inference ab initio prediction:Prodigal:2.6
locus_tag LFHBJEGH_33518
product hypothetical protein
962 675 CDS
inference ab initio prediction:Prodigal:2.6
locus_tag LFHBJEGH_335
product hypothetical protein
>Feature NODE_18194_1000_cov_2.550265
939 187 CDS
EC_number 1.14.99.46
db_xref COG:COG2141
gene rutA_3
inference ab initio prediction:Prodigal:2.6
inference similar to AA sequence:UniProtKB:P75898
locus_tag LFHBJEGH_33480
product Pyrimidine monooxygenase RutA
我想将节点 ID(“>”之后的名称)与“locus_tag”进行匹配。
我想要的输出如下:
Feature NODE_18_1000_cov_1.366138 LFHBJEGH_33517
Feature NODE_18222_1000_cov_1.310053 LFHBJEGH_33518
Feature NODE_18222_1000_cov_1.310053 LFHBJEGH_335
Feature NODE_18194_1000_cov_2.550265 LFHBJEGH_33480
哪个命令适用于此?
答案1
和awk
:
awk '/>Feature NODE_/{ nodeId=$0; next } /locus_tag/{ print nodeId, $2 }' infile