grep count lines code example
Example 1: grep count lines
cat myfile | wc -l
Example 2: grep count lines
wc -l myfile
Example 3: grep count lines
cat -n myfile
Example 4: grep count lines
grep -c ^ filename
Example 5: grep count lines
cat myfile | wc -l