i have to print first n lines of a file. how can i do that without using head command. for some reason i do not want to use Head. is there a way to get that result using awk or sed?.
i an using this on korn shell for AIX
Thanks..
i have to print first n lines of a file. how can i do that without using head command. for some reason i do not want to use Head. is there a way to get that result using awk or sed?.
i an using this on korn shell for AIX
Thanks..
sed -n '1,n' p file
sed -n '1p' file
awk 'FNR < 3' file
First two lines.
Thanks Guys...
What a strange question. Are you setting up a headless server??
Or it's just a homework assignment ...
awk 'NR<=10' <filename>
head -n could be the best option.I don't know why you are so particular about not using head