Fri, 18 Oct 2013

Using AWK to print column N and beyond

Sometimes you have a file that has a certain number of defined columns, and then some variable number of columns after that. Sadly, AWK doesn't have a nice way of specifying $N..., but this works well enough for me:

awk '{print substr( $0, index($0, <N>))}' filename

where you replace <N> with the column specifier (e.g. $11 or whatever).

Posted at: 15:08 | category: /computers/unix | Link