Summarize Unique IP Addresses in a Log File
Loops through each log file and dump output to a single file:
for file in `ls *.log`
do
cat $file |awk '{print $4}' |sort |uniq -c |sort -n >> output.txt
done
Now consolidate entries from each section of original file to a new file:
cat output.txt |awk '{print $2}' |sort |uniq -c |sort -n >> output2.txt
Where the $4 or $2 is the field to look at (space delimitated)
Posted: June 2nd, 2012 under Linux.
Comments: none