tail | grep
by gregs on Jun.30, 2005, under Uncategorized
After reading a quote on a mailing list last week about the concept behind unix tools and their focus on doing one task well and the OS allowing you to pipe several commands in one go, it dawned on me that I could do the following on log files:
CODE:
tail -f /var/log/syslog | grep "named"
So as the log fills up only items where the pattern "named" is found are displayed. Very neat!
June 29th, 2007 on 2:55 am
Oh, I just found this through Google. It was exactly what I was looking for, but I never thought it’d be *this* simple. Heehee.
July 16th, 2008 on 7:29 pm
Even better use “tail -f /var/log/logfile | grep pattern –color” to highlight the individual matched pattern
July 30th, 2008 on 1:10 am
The colour coding ability is a great addition, thanks Liam!
July 29th, 2009 on 4:01 pm
Nice man it’s what I looking for
,
September 24th, 2009 on 5:33 am
+1. Google “I’m Feeling Lucky” cool