标签:
[root@WebServer aa]# cat oldboy.txt
I am oldboy myqq is 49000448
[root@WebServer aa]# cat oldboy.txt |cut -d " " -f3,6
oldboy 49000448
[root@WebServer aa]# awk ‘{print $3,$6}‘ oldboy.txt
oldboy 49000448
多个分隔符
[root@WebServer aa]# cat oldboy.txt
I am oldboy,myqq is 49000448
[root@WebServer aa]# awk -F ‘[ ,]‘ ‘{print $3" "$6}‘ oldboy.txt
oldboy 49000448
[root@WebServer aa]# cat /etc/services |wc -l
10774
[root@WebServer aa]# cat -n /etc/services |tail -1 查看结果的最后一行
10774 iqobject 48619/udp # iqobject
[root@WebServer aa]# awk ‘{print NR}‘ /etc/services |tail -1
10774
[root@WebServer aa]# grep -n $ /etc/services |tail -1
10774:iqobject 48619/udp # iqobject
标签:
原文地址:http://www.cnblogs.com/chenshoubiao/p/4850124.html