[plug] multi-file find & replace

Bevan Broun bevanb at ee.uwa.edu.au
Fri Oct 23 16:12:59 WST 1998


on Fri, Oct 23, 1998 at 04:00:12PM +0800, Matt Kemner <zombie at networx.net.au> wrote:
> On Fri, 23 Oct 1998, Bevan Broun wrote:
> 
> > for f in `find . -name '*.htm' -print`;do
> > >g=`echo $f | sed -e 's/$/l/'`
> > >cp $f $g
> > >done
> 
> You'd probably want to use "mv" not "cp" there if you're just renaming
> files. :)

Yes - but if you make a mistake the files can all be moved to the same
thing and then it's out with the tapes. So I should have added:
 
after check all is as you want do:
find . -name '*.htm' -exec rm {} \;

> See the list archives for doing similar things using the tcsh and zsh
> shells. :)

I was going to say that but ..

-- 
Bevan Broun                                           ph (08) 9380 1587
Computer Systems Officer                             fax (08) 9380 1065
Dept. Electrical and Electronic Engineering      
University of Western Australia                                 rm. G70


More information about the plug mailing list