Print Nth Line of File#
$ sed -n '10p' file
This prints line number 10.
Ranges are also possible:
$ sed -n '3,5p' infile
prints lines 3, 4 and 5.
Print Every Nth Line of File#
To print lines 1, 11, 21, etc do
$ awk '{if (count++%10==0) print $0;}' input_file
To print lines 10, 20, 30, etc do
$ awk '{if (++count%10==0) print $0;}' input_file
You can also use the following to print every 5th line starting at line 2. This doesn't appear to work for me on Mac.
$ sed -n '2~5p' input_file
To
Shell - Linux.Shell - Mac.Shell