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

后端 未结 11 687
一生所求
一生所求 2020-12-22 20:23

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

11条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-22 21:21

    When you want to do a range of fields, awk doesn't really have a straight forward way to do this. I would recommend cut instead:

    cut -d' ' -f 9- ./infile
    

    Edit

    Added space field delimiter due to default being a tab. Thanks to Glenn for pointing this out

提交回复
热议问题