I'm trying to count the lines from a command and I'd also like to see the lines as they go by. My initial thought was to use the tee
command:
complicated_command | tee - | wc -l
But that simply doubles the line count using GNU tee
or copies output to a file named -
on Solaris.
complicated_command | tee /dev/tty | wc -l
But keep in mind that if you put it in a script and redirect the output, it won't do what you expect.