一、简介

 

二、教程

1)高级教程

 

三、实例

1)过滤字符(对大小写很敏感)

dir -l | awk '$3=="root" {print $1,$3,$4, $9;} ' 
cat tecmint_deals.txt | awk '$4 ~ /Tech/{print}'

2)使用shell变量

cat /etc/passwd | awk "/$username/ "' { print $0 }'
cat /etc/passwd | awk -v name="$username" ' $0 ~ name {print $0}'

3)统计排序

awk -F "" '{for (i=1;i<=NF;i++) print $i }' test.log|sort|uniq -c
posted on 2016-11-18 21:03  红孩儿你好  阅读(173)  评论(0)    收藏  举报