This question already has an answer here:
- Output file contents while they change 5 answers
/location/of/thefile, which is a continuously changing logfile. The average density of refreshes is 4 per minute, the possible maximal refresh rate could be 30-40 per minute. Every refresh adds 2-5 lines (average), but it could be hundreds in extreme cases. Every line begins with a
[YYYY-MM-DD HH:MM:SS] timestamp followed by plaintext (100-200, max. a few hundred characters).
My task is to construct a simple command which continuously watches this logfile, and sends to the stdout every lines that contain the
bar alphabetical strings. Before and after those (sub)strings there could be any characters (
\n only after the (sub)string, of course), even
\0. The capitalization of the words could be all of the possible variations.
Well, my ideas for the solution always contain syscalls for the timing, but I shouldn't use them. Please construct me a simple command. Thanks a very lot!