Andy Andy - 1 year ago 117
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 Source

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
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download