Friday, December 16, 2011

Small tricks for tab-delimeted files

Working on my current project includes a lot of manipulation with tab-delimited files (SAM,GFF, etc) Here are some nice tricks to remember.

Output only second field of a delimited file:
cat samout | cut -f 2

The same with awk:
awk '{print $2}'

Not related to tab-delimited files but still very useful :)

Compare two files based on their content:
cat file1 file2 | sort | uniq -u