常用的shell语句 【awk】去重,排列

目的:从日志access.log中,筛选出IP来,并统计每个IP出现的次数,然后显示出来。
因为:awk = 扒IP  shot = 排序  uniq =  去重
所以:awk '{print $1}' access.log | sort-n | uniq -c  
 
例如: cat error.log |grep 111.111.111.111 | awk '{print $14}' | sort -n | uniq -c      // 查询error.log 中出现过多少次的 111.111.111.111
原文地址:https://www.cnblogs.com/kaneyang/p/7411173.html