1. Find and print number of lines in a file sed -n '$ =' InputFile sed -n '$=' InputFile #saves one keystroke 2. Find a pattern (say "E7") at given character location starting 829 sed -nE '/^.{829}E7/' < InputFile 30. Generate a file with running numbers (10 lines, in this case) yes | head -n 10 | nl | sed 's/^Iy//' > OutFile #^I is cntrl V+tab yes | head -10 | nl -s " " | sed 's/ y//' > OutFile more OutFile 1 2 3 4 5 6 7 8 9 10 4. Fold sets of "n" lines in the input file into a single line sed -n 'N;N;s/\n//g;p'