wc -l to count the lines in output of a command, as the input is piped to it.
commad | wc -l
This works fine, but if
command is doing some heavy computation, this is quite slow. Is there an alternative which displays the count of lines which have been "piped in so far"?
Such a thing would especially be useful when I'm doing a sort of per-item computation, like
cat something | xargs -L1 heavy-per-line-computation | wc -l
One way I could do this manually is to pipe the output to a file (
command > file) and periodically do
cat file | wc -l on it. But a single command (which doesn't redirect to files, to avoid wasteful I/O), is what I'm after.