I have to inspect a growing log in real time, and I found an issue that makes me miss some lines (I can't understand exactly what lines) using
tail -f or
grep because I want to filter lines containing a specific word, and then
cut -c -NUM because some lines are very long and I don't want them to wrap in my terminal window.
Here is a minimal example, in which I'm watching a sample log made of "Nth line" lines, filtering for word "line", missing all lines in this case (obviously
^C is me killing the process):
$ tail -n 3 -f log 13th line 14th line 15th line ^C $ tail -n 3 -f log | grep --color=never 'line' 13th line 14th line 15th line ^C $ echo $COLUMNS 100 $ tail -n 3 -f log | grep --color=never 'line' | cut -c -$COLUMNS ^C
Note that this issue occours only with
tail -f (or
cut combined. If I do not use
grep in the middle, or
cut at the end of the pipe, there's no missing line. If I replace
tail -f with
cat, no problem. You can see every possible case in this longer example.
I'm on Ubuntu 13.04, GNU coreutils (
cut) version 8.20 and GNU grep 2.14.