bash count lines code example
Example 1: shell count lines output
$ somecommand | wc -l
Example 2: shell count number of lines
$ wc -l < /dir/file.txt
3272485
Example 3: count new lines bash
command | wc -l
wc -l < some_file.txt
$ somecommand | wc -l
$ wc -l < /dir/file.txt
3272485
command | wc -l
wc -l < some_file.txt