Hi,
I have 500 MB of file.
I want to retain first line and last line of the file.
I am unaware of deleting lines from a file in PERL.
How can i do it in PERL?
Regards
VANITHA
Hi,
I have 500 MB of file.
I want to retain first line and last line of the file.
I am unaware of deleting lines from a file in PERL.
How can i do it in PERL?
Regards
VANITHA
hope this helps
http://www.perlmonks.org/?node_id=349106
For a file of that size the shell's head/tail commands should be much faster than opening and iterating through it using Perl.
I'd do something like -
(head -1 myfile >myfile.tmp; tail -1 myfile >>myfile.tmp) && mv myfile.tmp myfile
tyler_durden
Sed way ..
$ sed -n '1p;$p' infile > infile.tmp