in reply to Search and replace
This just opens a file, does a search and replace within the file (see. the $^I variable), then renames it to the new file. This could probably be done in a line or two of shell and perl, but this is nice'n'pure :o)use strict; use File::Copy; my $dest_file = "email.lst"; my $searchstr = 'blue'; my $repstr = 'foo'; open(FL, $dest_file) or die("Doh - $!"); # turn on inplace edit flag (see. man perlvar) $^I = '~'; s/$searchstr/$repstr/g while <FL>; close(FL); move($dest_file, $repstr);
broquaint
|
|---|