一般而言,最好在脚本内部设置字段分隔符,因为这样可以少输入一个命令行参数。
It's generally best to set the field separator inside the script itself, simply because it means you have one less command line argument to remember to type.
两种方法的区别在于如何设置字段分隔符。
The difference between these two methods has to do with how we set the field separator.
在该脚本中,(通过设置FS变量)在代码中指定字段分隔符,而前一示例通过在命令行向awk传递- F “: ”选项来设置FS。
In this script, the field separator is specified within the code itself (by setting the FS variable), while our previous example set FS by passing the -f ":" option to awk on the command line.
应用推荐