Showing posts with label text search in file. Show all posts
Showing posts with label text search in file. Show all posts

Tuesday, December 11, 2012

How to do something with bash when a text line appear to a file

Use command
tail -f file.log | grep --line-buffered "my pattern" | while read line
do
  echo $line
done
The --line-buffered is the key here, otherwise the read will fail.