I needed to quickly browse through some web-server logs and pull out the hostnames which were accessing the web-server (to see where people were originating from).
The following single linux command will pull the IP address out of the apache log (for a particular date) and do the reverse DNS lookup for me:
cat access.log | grep ’1/Sep’ | awk ‘{print $1}’ | sort | uniq | xargs -n1 host | grep -v ‘not found’
just in case i ever need it again….
Related posts:
- Making Resolving Conflicts in Git Easier One thing that bugs me when using Git, is that...
- Mounting NAS drive under Ubuntu I’ve been battling this one for a long time….Finally got...
- Finding out what’s process is listening on port 80 Just saw an excellent tweet by @chadmyers: FYI, to find...
- Instant Twitter Bookmark Tonight’s been a busy night for silly coding This first...
- Scripting Google Chrome for OSX using AppleScript When it comes to software tools, i like to spend...

Interesting query. I am definately going to have to play around with that command.