count lines after grep code example Example 1: grep count lines wc -l myfile Example 2: grep count lines grep -c ^ filename