|
|
Question : read lines from a tail(ed) -f file.
|
|
I have a log file that I need to monitor for certain events. I want the event I am looking for to be captured so I can modify the line and save to a new file. This will eventually run as a service. It appears there is a breakdown in the redirection to the read line command. This is what I have: tail -f "logfile_name" | grep "eventName" | while read line do echo $line done To test I tail -f | grep "eventName the logfile and then run this script in a seperate shell. The output should be the same, but sometimes it gives me output and sometimes not.
|
Answer : read lines from a tail(ed) -f file.
|
|
Is one shorter? it's probably because the pipes are buffered it may or may not help to use something like tail -f logfile_name | perl -ne '$|=1; print if /eventName/' | while read line
|
|
|
|