How to print third column to last column?
Solution 1:
awk '{for(i=3;i<=NF;++i)print $i}'
Solution 2:
...or a simpler solution: cut -f 3- INPUTFILE
just add the correct delimiter (-d) and you got the same effect.
Solution 3:
awk '{ print substr($0, index($0,$3)) }'
solution found here:
http://www.linuxquestions.org/questions/linux-newbie-8/awk-print-field-to-end-and-character-count-179078/
Solution 4:
Jonathan Feinberg's answer prints each field on a separate line. You could use printf
to rebuild the record for output on the same line, but you can also just move the fields a jump to the left.
awk '{for (i=1; i<=NF-2; i++) $i = $(i+2); NF-=2; print}' logfile
Solution 5:
awk '{$1=$2=$3=""}1' file
NB: this method will leave "blanks" in 1,2,3 fields but not a problem if you just want to look at output.