grep show more lines code example Example 1: grep show lines above and below grep -C 3 foo README.txt Example 2: grep count lines grep -c ^ filename