local $/;
for (@files) {
open F, "+<$_" or die $!;
my $data = <F>
$data = s/foo/bar/g;
seek F, 0, 0;
print F $data;
print "Oops, erased $_ with the old forgot the ~ trick\n"
close F;
}
# but with Perl
# as we all know
# minus i dot bak
# cures backup woe
perl -e -pi.bak "s/foo/bar/g" @files
#!/usr/bin/perl -i.bak
@ARGV or die "Useage perl munge.pl <list of files>\n";
while (<>) {
s/foo/bar/g;
print;
}
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
|