/tmp $ df -h|grep /dev/mtdblock/5|awk '{if($5+0>=50) print($0)}'
/dev/mtdblock/5 14.0M 7.0M 7.0M 50% /resource
awk去掉%
带%的比较
awk使用关联数组存储同一个user所有的内容
cat file
12/Feb/2012:23:59:48 /jy3/main.jsp user1
12/Feb/2012:23:59:48 /js4/main.jsp user2
12/Feb/2012:23:59:51 /js4/main.jsp user3
12/Feb/2012:23:59:51 /jy3/main.jsp user3
12/Feb/2012:23:59:53 /js4/main.jsp user4
要求找出同一个user包含 /jy3/main.jsp 和 /js4/main.jsp 的行
12/Feb/2012:23:59:51 /js4/main.jsp user3
12/Feb/2012:23:59:51 /jy3/main.jsp user3
awk '{a[$3]=a[$3]?a[$3]RS$0:$0}END{for(i in a){if(a[i]~/js4/&&a[i]~/jy3/)print a[i]}}' file
使用关联数组存储同一个user所有的内容
awk '{printf "%c",39}' file
awk '{printf "%c",34}' file
阅读(1510) | 评论(0) | 转发(0) |