how about:
for f in `find . -name '*.java'`; do
mv $f $f.bak
sed 's/foo\.bar/foo.baz/g' $f.bak > $f
done
David :)
> -----Original Message-----
> From: Eric Friedman [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, August 18, 1999 9:30 AM
> To: Ben Coughenour
> Cc: [EMAIL PROTECTED]
> Subject: Re: repackaging - any tools?
>
>
> Ben,
>
> That's far too elegant. ;-)
>
> How 'bout using find (if only to show the windoze folks what they're
> missing)?
>
> [untested]
> find . -name '*.java' | xargs perl -pi.bak -e 's/package foo\.bar/package
> foo.baz/'
>
> or some such.
>
> Eric
>
> : Below is a perl script that I wrote a while ago to do pretty much the
> same
> : thing to our web site. It should be fairly obvious what you need to
> change
> : to apply to your task.
> :
> : Ben
> :
> : #!/usr/local/bin/perl -w
> :
> : ##
> : # Simple script to parse a list of files and change all occurances of
> one
> : value to another
> : # Ben Coughenour - July 1998
> : ##
> :
> : sub UpdateFile
> : {
> : $file = shift @_;
> : print "Updating $file\n";
> : my @lines;
> : open FILEi, "$file" or die "Can't open file $file";
> : while( <FILEi> )
> : {
> : # Using ! instead of normal / operator to accomodate changing
> directory
> : names
> : # format = s!<old_value_reg_exp>!<new_value>!g;
> :
> :
> :
> s!http://47.202.33.26:8080/GSFGlobalSystem/Components/Billing/sdm/billing.
> css
> !/nma/stylesheets/billing.css!g;
> :
> :
> :
> s!http://47.202.33.26:8080/GSFGlobalSeystem/Components/Billing/sdm/!/nma/!
> g;
> : push( @lines, "$_");
> : }
> : close FILEi;
> :
> :
> : open FILEo, ">$file" or die "Can't open file $file";
> : print FILEo @lines;
> : close FILEo;
> : }
> :
> :
> : while( $filename = shift )
> : {
> : UpdateFile( $filename );
> : }
> :
> : --
> : Ben Coughenour | 4 am? Already? Oh no, not again!!
> : [EMAIL PROTECTED] |
> : (919) 991-7733 |
> :
> :
> :