unix: displaying lines n to m of a file

walla

Senior member
Jun 2, 2001
987
0
0
In unix, what command can I use to display lines n to m of a file.

For instance, given the file test.txt, what command and syntax do I use to print lines 150 to 300 (and assume the last line is greater than 300).

Thanks.
 

cleverhandle

Diamond Member
Dec 17, 2001
3,566
3
81
I'm not sure if this is the simplest way, but you can use sed with something like...

cat test.txt | sed -n 150,300p