$ awk –F’,’ ’{print $1,$2}’ test.txt
AWK命令类似于上面,test.txt内容如下
#!/bin/bash
2 this is a test
3 Are you like awk
This's a test
10 There areorange,apple,mongo,xiangjiao,boluo,yezi
以逗号为分隔符,脚本运行输出如下
#!/bin/bash
2 this is a test
3 Are you like awk
This's a test
10 There are orangeapple
如果print $0,全部打印出来