Andy Andy - 1 month ago 11
Linux Question

Using awk to print all columns from the nth to the last

right now I have this line, and it worked until I had whitespace in the second field.

svn status | grep '\!' | gawk '{print $2;}' > removedProjs


is there a way to have awk print everything in $2 or greater? ($3, $4.. until we don't have anymore columns?)

I suppose I should add that I'm doing this in a windows environment with cygwin.

Answer

will print all but very first column:

awk '{$1=""; print $0}' somefile

will print all but two first columns:

awk '{$1=$2=""; print $0}' somefile