Hi
All,
I have AIX 5.3 server. I have one big file. in that i want to remove 5000 line from top. is there any command for this?
Thanks,
Vishal
Hi
All,
I have AIX 5.3 server. I have one big file. in that i want to remove 5000 line from top. is there any command for this?
Thanks,
Vishal
One way
awk ' NR>5000 ' oldfile > smallerfile
another way:
sed '1,5000d' oldfile > smallerfile
bakunin
what is old file and smaller file? if i understand correctly then old file is existing file and smaller file will be new file after removing top lines. just want to make sure that i don't want to change file name. i want file name as it is.
Thanks,
Vishal
you can try this
vi - filename <<!
:1,5000d
:wq
!
write in command line or in any script.. it won't change your filename
Errm...yes. The downside of using vi is that vi will create a backup file in /var/tmp when it opens the file. When the file you are going to edit is very large chances are the space in /var/tmp will not suffice and you will get an error opening it.
I hope this helps.
bakunin
awk ' NR>5000 ' oldfile > smallerfile
mv smallerfile oldfile
rename smallerfile to oldfile