使用“|”来擦除。替代运营商 [英] grepping using the "|" alternative operator
本文介绍了使用“|”来擦除。替代运营商的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是一个名为AT5G60410.gff的大文件的示例:
Chr5 TAIR10基因24294890 24301147。 +。 ID = AT5G60410;注意= protein_coding_gene;名称= AT5G60410
Chr5 TAIR10 mRNA 24294890 24301147。 +。 ID = AT5G60410.1;亲本= AT5G60410;名称= AT5G60410.1;索引= 1
Chr5 TAIR10蛋白24295226 24300671。 +。 ID = AT5G60410.1-蛋白质;名称= AT5G60410.1; Derives_from = AT5G60410.1
Chr5 TAIR10外显子24294890 24295035。 +。父母= AT5G60410.1
Chr5 TAIR10 five_prime_UTR 24294890 24295035。 +。父母= AT5G60410.1
Chr5 TAIR10外显子24295134 24295249。 +。 Parent = AT5G60410.1
Chr5 TAIR10 five_prime_UTR 24295134 24295225。 +。 Parent = AT5G60410.1
Chr5 TAIR10 CDS 24295226 24295249。 + 0亲本= AT5G60410.1,AT5G60410.1-蛋白质;
Chr5 TAIR10外显子24295518 24295598。 +。 Parent = AT5G60410.1
我在使用grep从这个文件中抽取特定行时遇到了一些麻烦。我想提取所有第三列中指定的基因类型或外显子类型的行。我感到惊讶,当这不起作用:
grep'gene | exon'AT5G60410.gff
没有结果返回。我在哪里出了问题?
解决方案
您需要转义 |
。
grepgene\ | exonAT5G60410.gff
The following is a sample of a large file named AT5G60410.gff:
Chr5 TAIR10 gene 24294890 24301147 . + . ID=AT5G60410;Note=protein_coding_gene;Name=AT5G60410
Chr5 TAIR10 mRNA 24294890 24301147 . + . ID=AT5G60410.1;Parent=AT5G60410;Name=AT5G60410.1;Index=1
Chr5 TAIR10 protein 24295226 24300671 . + . ID=AT5G60410.1-Protein;Name=AT5G60410.1;Derives_from=AT5G60410.1
Chr5 TAIR10 exon 24294890 24295035 . + . Parent=AT5G60410.1
Chr5 TAIR10 five_prime_UTR 24294890 24295035 . + . Parent=AT5G60410.1
Chr5 TAIR10 exon 24295134 24295249 . + . Parent=AT5G60410.1
Chr5 TAIR10 five_prime_UTR 24295134 24295225 . + . Parent=AT5G60410.1
Chr5 TAIR10 CDS 24295226 24295249 . + 0 Parent=AT5G60410.1,AT5G60410.1-Protein;
Chr5 TAIR10 exon 24295518 24295598 . + . Parent=AT5G60410.1
I am having some trouble extracting specific lines from this using grep. I wanted to extract all lines that are of type "gene" or type "exon", specified in the third column. I was suprised when this did not work:
grep 'gene|exon' AT5G60410.gff
No results are returned. Where have I gone wrong?
解决方案
You need to escape the |
. The following should do the job.
grep "gene\|exon" AT5G60410.gff
这篇关于使用“|”来擦除。替代运营商的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文