commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Useful for grepping an IP range from the maillog. When for instance dealing with a spam-run from a specific IP range, or when errors occur from or to a specific IP-range.
In the example above the IP range 184.108.40.206/10 (220.127.116.11 - 18.104.22.168)
To grep the IP range 22.214.171.124/19 (126.96.36.199 - 188.8.131.52) from the maillog:
egrep '124\.217\.2(2[4-9]|[0-9]|5[0-5])' -J /var/log/maillog*
NOTE: the location of the maillog may vary based upon operating system and distribution.
There is 1 alternative - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.