Select a particular column using awk or cut or perl

后端 未结 4 1166
天涯浪人
天涯浪人 2021-02-04 03:20

I have a requirement to select the 7th column from a tab delimited file. eg:

cat filename | awk \'{print $7}\'

The issue is that the data in th

4条回答
  •  爱一瞬间的悲伤
    2021-02-04 03:39

    If the data is unambiguously tab-separated, then cut will cut on tabs, not spaces:

    cut -f7 filename
    

    You can certainly do that with awk, too:

    awk -F'\t' '{ print $7 }'
    

提交回复
热议问题