Categories
Linux Programming

Extract unique IP’s from a log

The command is

grep “search text” logfile_name | cut -d' ' -f1 | sort | uniq

The ‘cut‘ command is useful. The -d specifies the delimiter. Here the delimiter is space. Then ‘f1‘ means the first field.

And, to count requests per IP – https://nealpoole.com/blog/2010/08/apache-tip-how-to-count-requests-per-ip/

Categories
Linux Programming

Extract unique IP's from a log

The command is

grep “search text” logfile_name | cut -d' ' -f1 | sort | uniq

The ‘cut‘ command is useful. The -d specifies the delimiter. Here the delimiter is space. Then ‘f1‘ means the first field.
And, to count requests per IP – https://nealpoole.com/blog/2010/08/apache-tip-how-to-count-requests-per-ip/