I know of course that
cat logfile.txt | wc -l
120
will tell me the number of lines in a file.
Whereas
tail -f logfile.txt
will show me the new lines that another program writes to logfile.txt
.
Is it possible to combine both so that I get a continuous updating line count of logfile.txt with standard text utilities?
I do know about
watch wc -l logfile.txt
but I do not want to re-count the whole file each time, that seems to be a waste. One would need an appended-only count every second or so and probably an \r
instead of an \n
at the end of line.
cat
output towc
is also a big waste!!