Tail Requests From Shell IP

Often when using a dev machine, your checking some shared logs for output about your specific process, turning a singlethreaded process into a mutithreaded output buffer. Not something that increases my sanity level. Instead of deal with that, I just wanted to filter out any traffic that isn’t from whatever IP is bound to the shell connection. After a little bit of RegEx and pipe magic I got it:

tail -f [log_file_here] | grep $( finger `whoami`| sed -n 's/.* from \([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*/\1/p')

Nothing groundbreaking, but it saves me work.

Leave a Reply