cut from column X until the end of a tab delimited file

Dnaiel picture Dnaiel · Oct 17, 2012 · Viewed 13.2k times · Source

If I have a file with an unknown number of column but I know I want columns X til the end, is there an easy way to use cut for this?

Let us say X=5,

I used, cut -f5- filename but it did not work.

Then I am trying to specify the -d'\t' and also it does not work.

Not sure what I am doing wrong.

Any help will be greatly appreciated.

thanks!

Answer

Steve picture Steve · Oct 17, 2012

You're very close, but you're missing the dollar sign in there:

cut -d $'\t' -f5- file.txt