On 10/22/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I would like to replace a part of a really big (4GB) text file. And
> the contents that I want to change is really a small but continuous
> portion. Could some one please help me with the best way I can do this
> in perl?
>
use perl one-liner,
perl -pi.bak -e 's/foo/bar/' file
or just read the file line by line and print the (modified) content to
a new file,
open RD,"file1" or die $!;
open RW,">file2" or die $!;
while(<RD>) {
s/foo/bar/;
print RW;
}
close RW;
close RD;
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/