Search This Blog


Print n'th column to end of line in awk

If you have output where you only want a certain number of colums printed in awk you can easily modify how awk loops through to display entries.

The easiest method is a simple for loop where i=column

The following grabs me the cmdline entry required for kexec. Or what would be included in /proc/cmdline

awk /kernel.*console/'{for(i=3;i<=NF;++i)printf("%s ",$i)}' /boot/grub/grub.conf


No comments:

Post a Comment