awk 是一种文本处理工具,强大性不多讲。
print $2 是以空格做为分隔符,打印第二列(域)的内容。
比如一个文件 test 中包含:
nq male hello
venus female hello
要求打印出1、3列内容。
[root@svn tmp]# awk ‘{print $1,$3}’ test
nq hello
venus hello
[root@svn tmp]#
原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/1804.html