Created
February 8, 2015 22:03
-
-
Save coboshm/fa40190cd039eb68ade9 to your computer and use it in GitHub Desktop.
Access.log get the first five ip with more visits and the number of visits
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Marc Cobos | |
FILE=test.access.log | |
for ip in `cat $FILE |cut -d ' ' -f 1 |sort |uniq`; | |
do | |
COUNT=`grep ^$ip $FILE |wc -l`; | |
echo $COUNT ' : ' $ip | |
done | sort -rn -k1 | head -5 | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment