One liners, snippets and small scripts

Author
Published

November 26, 2012

Often I use one liners or small scripts for useful task but I keep forgetting about those. So I’ll just put them here for future reference.

Count number occurrences in a column/field. In this case, how many lines in a GFF3 file exist for each chromosome.

cut -f1 hg19.GFF3 | sort | uniq  -c | sort  

This can be further refined and count only genes per chromosome using a simple grep:

grep "gene" hg19.GFF3 | cut -f1 | sort | uniq  -c | sort  

Reuse

Citation

BibTeX citation:
@online{domingues2012,
  author = {Domingues, António},
  title = {One Liners, Snippets and Small Scripts},
  date = {2012-11-26},
  url = {https://amjdomingues.com/posts/2012-11-26-one-liners-snippets-and-small-scripts/},
  langid = {en}
}
For attribution, please cite this work as:
Domingues, António. 2012. “One Liners, Snippets and Small Scripts.” November 26, 2012. https://amjdomingues.com/posts/2012-11-26-one-liners-snippets-and-small-scripts/.