4 column tsv file, output 1 specific column

Hello all

siteexplorer.search.yahoo.com can output results in tsv format, when opened in excel I get 4 columns.

I would like to wget that file, which I can do. I would then like to pull the 2nd column and output it only.

I've searched around and found a few bits and pieces but nothing I've been able to get working as yet.

If it matters I'm doing this on a Centos 5.1 machine.

Any help would be great.

Thanks

Perhaps the following will assist...
(I changed the tab to a ~ so I can more easily cut on fields.)

> cat file66.tsv
13      Oct     Joe     smile
18      Jan     Linda   laugh
11      Nov     Vets    march

> cat file66.tsv | tr "\t" "~" | cut -d"~" -f2
Oct
Jan
Nov

Alternatively:

cat file66.tsv|awk '{print $2}'

So, if your input file was slightly different, you might not get your desired results with a 'plain' awk. See below where there is a single space between the month and a number:

> cat file66c.tsv
13      Oct 1   Joe     smile
18      Jan 2   Linda   laugh
11      Nov 3   Vets    march

> cat file66c.tsv | tr "\t" "~" | cut -d"~" -f2
Oct 1
Jan 2
Nov 3

> cat file66c.tsv | awk '{print $2}'
Oct
Jan
Nov

Using awk in that way isn't going to work for the task, it's going to assume space is the seperator and if column 1 has more than 1 word etc it will get the wrong information.

You're right. I missed the extra space. Nice catch.

It would work this way, though:

cat file66c.tsv|awk -F"\t" '{print $2}'

Thanks, the tr and cut command seems to be doing the trick. I did notice a few results missed the correct entry but this may be due to bad formating in the tsv file?

thanks