Friday, August 23, 2013

tail & grep

1. search for 1 word

http://stackoverflow.com/questions/7161821/how-to-grep-a-continuous-stream
Turn on grep's line buffering mode.
tail -f file | grep --line-buffered   my_pattern

tail -f /home/saiponduru/dev/pyr/pyr-greenzone/log/development.log | grep --line-buffered Rendered

2. search for multiple words

http://www.cyberciti.biz/faq/searching-multiple-words-string-using-grep/
$ grep 'warning\|error\|critical' /var/log/messagesTo just match words, add -w swith:
$ grep -w 'warning\|error\|critical' /var/log/messagesegrep command can skip the above syntax and use the following syntax:
$ egrep -w 'warning|error|critical' /var/log/messages
I recommend that you pass the -i (ignore case) and --color option as follows:
$ egrep -wi --color 'warning|error|critical' /var/log/messages

tail -f /home/saiponduru/dev/pyr/pyr-greenzone/log/development.log | egrep -wi --line-buffered 'rendered|account'
OR
From pyr-greenzone directory -
tail -f ./log/development.log | egrep -wi 'rendered|account'


No comments:

Post a Comment

Followers

Blog Archive