首页 > 代码库 > 简单实现取访问日志的IP
简单实现取访问日志的IP
cat bbs.access.2014-05-01.log | awk ‘{print $1}‘ | sort -n | uniq -c | sort -n | tac | head -n 10
cat bbs.access.2014-05-01.log | awk ‘{print $1}‘ | sort -n | uniq -c | sort -n | tail -n 10
cat bbs.access.2014-05-01.log | awk ‘{print $9}‘ | sort -n | uniq -c
[root@mode ~]# awk ‘{print $1}‘ access_2010-12-8.log| sort -n | uniq -c |sort -nr -k1
9 59.33.26.105
8 124.115.4.18
3 123.122.65.226
[root@mode ~]# awk ‘{print $1}‘ access_2010-12-8.log| sort -n | uniq -c |sort -n|tac
9 59.33.26.105
8 124.115.4.18
3 123.122.65.226
NAME
tac - concatenate and print files in reverse #在反向连接和打印文件
-r, --regex
interpret the separator as a regular expression #解释分离器作为一个正则表达式
本文出自 “Try to be brave” 博客,谢绝转载!
简单实现取访问日志的IP