The count of rows to stdout in real time?

0 like 0 dislike
3 views
There is a script that does something and spits out to stdout lines. (for example tail-f /var/log/messages).

I content that stdout is not necessary, but need in real time to see how many lines it spit out to stdout.


There are such utilities or scripts? and wants a bike to write.

UPD. solved forces awk and carriage return
tailf /some/file.log | awk 'BEGIN {C=0} ; {printf "\", C++" "}'

UPD2 hacked to use the built-in variables:
tailf /some/file.log | awk '{printf "\"NR}'
by | 3 views

3 Answers

0 like 0 dislike
You can do
cat -n for line numbers displayed
grep or sed to remove everything except the line numbers
\r
And I have in payp to join
by
0 like 0 dislike
It is easier still to reinvent the wheel.
Sketch (as an idea):
\r
tail-f /some/path/file.log >/tmp/tail.txt & [1] 17855 while true; do wc-l /tmp/tail.txt;sleep 3;done 29 /tmp/tail.txt 29 /tmp/tail.txt 29 /tmp/tail.txt 44 /tmp/tail.txt 72 /tmp/tail.txt 
by
0 like 0 dislike
pv has a utility that does this.
\rdebian.pro/527
by

Related questions

0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
asked Jun 5, 2019 by tera1004
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
asked May 20, 2019 by EmachinesDIMA
110,608 questions
257,186 answers
0 comments
28,863 users