Thursday, May 21, 2009

How to look at individual columns of a tab delimited file?

We have already seen this in action. The command is cut and it can be used to look at the individual columns of a tab delimited file like so:

> cut -f1,2,5,7 somefile.tab

You can in fact look at any text file using cut. There is a switch that lets you specify the delimiting character. For example let's say you wanted to look at a coma delimited file. The command line would look like this:

> cut -d',' -f1,2,8,15

Give it a try!

No comments: