Answers for "awk output specific column"

0

awk output specific column

awk '{print $0}' file    #打印所有列
awk '{print $1}' file  #打印第一列
awk '{print $1, $3}' file   #打印第一和第三列
cat file | awk '{print $3, $1}'   #打印第三列和第一列,注意先后顺序。
cat file | awk '{print $3, $NF}' #打印第三列和最后一列
awk -F ":" '{print $1, $3}'  #以“:”为分隔符分割列,然后打印第一列和第三列
Posted by: Guest on February-27-2022

Browse Popular Code Answers by Language