假设我们有这个数据文件.
john 32 maketing executive jack 41 chief technical officer jim 27 developer dela 33 assistant risk management officer
我想用awk打印
john maketing executive jack chief technical officer jim developer dela assistant risk management officer
我知道可以使用.
awk '{printf $1; for(i=3;i<NF;i++){printf " %s",$i} printf "\n"}' < file
问题是它的长,看起来很复杂.
是否还有其他简单的打印方式来打印其余的字段.
将要跳过的字段设置为空白:
awk '{$2 = ""; print $0;}' < file_name
资料来源:Using awk to print all columns from the nth to the last