in reply to doing a search and replace on a large file
Just about the way you outlined:
open(INPUT,"<$bigfile") ||die "Could not open $bigfile:$!\n"; open(OUTPUT,">$newfile")||die "Could not open $newfile:$!\n"; while (<INPUT>) { print OUTPUT $_ # note no semicolon here... unless /whatever condition matches the patterns you want/; } close(INPUT) || die "Could not close $bigfile: $!\n"; close(OUTPUT)|| die "Could not close $newfile: $!\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: doing a search and replace on a large file
by b10m (Vicar) on Apr 14, 2004 at 12:48 UTC | |
Re: Re: doing a search and replace on a large file
by aquarium (Curate) on Apr 14, 2004 at 14:05 UTC |
In Section
Seekers of Perl Wisdom