To print n lines of a file

589
To print N lines of a file from <start> to <end>

syntax

sed -n ‘<start>,<end> p’ filename

Examples

To print line 10 to 20 from the file knol.txt

sed -n ‘10,20p’ knol.txt

To print line 10 to end from the file knol.txt

sed -n ’10,$p’ knol.txt

To print nth line of a file

sed -n ‘p’ filename