Alex Rivera | Logout

How to print all the columns after a particular number using awk?

Asked 2011-02-22T17:57:17.487
115

On shell, I pipe to awk when I need a particular column.

This prints column 9, for example:

... | awk '{print $9}'

How can I tell awk to print all the columns including and after column 9, not just column 9?

Edit
Report

1 Answer

117
awk '{ s = ""; for (i = 9; i <= NF; i++) s = s $i " "; print s }'
answered 2011-02-22T18:09:28.270

Your Answer