Operating System - HP-UX
1833873 Members
1953 Online
110063 Solutions
New Discussion

write first 100 lines to a new file

 
SOLVED
Go to solution
Kamran Hussain_1
Occasional Contributor

write first 100 lines to a new file

How do I take the first 100 lines of file A and write it to file B ?
Thanks.
3 REPLIES 3
Stefan Farrelly
Honored Contributor
Solution

Re: write first 100 lines to a new file

head -100 >
Im from Palmerston North, New Zealand, but somehow ended up in London...
Francois Bariselle_3
Regular Advisor

Re: write first 100 lines to a new file

Hi,

You can use this command:

head -n 1000 'your file' > 'output'

Frank.
Fais la ...
James R. Ferguson
Acclaimed Contributor

Re: write first 100 lines to a new file

Hi:

How about:

# sed -n '1,100p' filename > filename.new

Regards!

...JRF...