Copy only the initial 10 lines from a file to another

Hi all,

I'm new to shell scripting.
I want to copy initial few lines(say first 10 lines) from a file to another file.
There is no "head" command in our embedded system.
sed & awk is there which I believe will do that, but I dont know how to.
This is linux 2.6 (embedded)

So please help me.

Thanks
Jay

sed -n '1,10p' file1 > file2

Try this..

sed -n '1,10p' filename > newfile

Regards,
Chella

sed -e "10q" filename > newfile

thanks a lot for help.
Just one more query.

How to copy the whole file, except last N lines to another file?

cnt=`wc -l < file`
awk -v var=$cnt 'NR <= var - 5' file