100 line from a certain line need to print

Hi Friends

I need one information, I want to print 100 line from a particular line of file, then want to store it in another file.

i used less or more but not able to store the data in another file.

Please help.
Thanks
Joy

sed -n '1,100 p' input_file > output_file

--ahamed

Its not working when starting point is 200th line.

In what way is it "not working"?

$ initial=100; tillend=$((initial+100))
$ nawk -v start="$initial" -v end="$tillend" 'NR==start,NR==end' infile
sed -n '200,300 p' input_file > output_file

--ahamed

1 Like

if you want print the last 100 line in the file

head <filename>|tail -100

you want to print 100th -200th line of the file then you can use

head -200| <filename>|tail -100

i hope understand ur requirement correctly

1 Like

Thanks friends.
First time I didn't get ahamed101's reply. Thanks again for this help..