linuxshellawkcygwin

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


This line 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 any more columns?)

I'm doing this in a Windows environment with Cygwin.


Solution

  • Print all columns:

    awk '{print $0}' somefile
    

    Print all but the first column:

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

    Print all but the first two columns:

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