count number of lines printed on shell code example
Example 1: shell count lines output
$ somecommand | wc -l
Example 2: shell count number of lines
$ wc -l < /dir/file.txt
3272485
$ somecommand | wc -l
$ wc -l < /dir/file.txt
3272485