文件 countagresult.txt 如下:
Gm01 phytozome6 CDS 51481 51625 0 - 1
Gm01 phytozome6 exon 51481 51625 0 - .
Gm01 phytozome6 CDS 51828 51925 0 - 0
Gm01 phytozome6 exon 51828 51925 0 - .
Gm01 phytozome6 CDS 52362 52465 8 - 2
Gm01 phytozome6 exon 52362 52465 8 - .
Gm01 phytozome6 CDS 52517 52571 0 - 0
Gm01 phytozome6 exon 52517 52571 0 - .
linux 命令
less -S countagresult.txt |awk '$3=="exon"{sum +=$6}END{print sum}'shipped
参考websit:
https://blog.sciencenet.cn/blog-294163-519114.html