find . -type f -name "*.txt" -name "*.html" | xargs plrename "s/foo/bar/g;"
where plrename is the following script (I keep mine in /usr/local/bin):
#!/usr/bin/perl
# rename -- Larry's Filename Fixer
$op = shift or die "Usage: rename exper [files]\n";
chomp(@ARGV = <STDIN>) unless @ARGV;
for (@ARGV) {
$was = $_;
eval $op;
die $@ if $@;
rename ($was, $_) unless $was eq $_;
}
-----Original Message-----
From: Michael Ryan Byrd [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 09, 2003 15:16
To: [EMAIL PROTECTED]
Subject: [uug] search and replace
I've asked this before, but I forgot the answer
On my redhat box, I need to search through a bunch of directories (nested) in my
webroot that contain many different kinds of files.
Inside all the .txt and .html files I need to replace the word "foo" with "bar"
Anybody got a nifty command line creation for that task?
TIA,
Ryan
____________________
BYU Unix Users Group
http://uug.byu.edu/
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
____________________
BYU Unix Users Group
http://uug.byu.edu/
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list