[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] Misc perl manips
Misc questions I was asked today...
Step 1: Backup everything. :) then...
Task:
Recursively rename all files named *.rpm to *.rm
Solution:
open (IN, "find ./ -name '*.rpm' |");
while (<IN>) {
chomp;
my $file = $_;
my $newfile = $file;
$newfile =~ s/\.rpm$/\.rm/;
print "moving $file to $newfile...\n";
rename($file, $newfile) or die @!;
}
close IN;
Task:
Recursively change '.rpm' to '.rm' inside all HTML files.
Solution:
perl -pi -e 's/\.rpm/\.rm/g' `find ./ -name "*.html"`
Gotta love it,
j