[Gllug] error in bash script to rename files in a directory

Stig Brautaset gllug at brautaset.org
Mon Dec 30 23:41:09 UTC 2002


On Dec 30 2002, Pete wrote:
> On Fri, 2002-12-27 at 23:44, Liam Delahunty wrote:
> >  :1,$s/php3/php/g
> 
> The '1,$' can be abbreviated as '%'. :)
> 
> Alternatively, if you don't want to open each file in turn in vi for
> this, you could instead do this:
> 
> $ perl -p -i.bak -e 's/php3/php/g' *

Or without perl:

for i in *; ex $i <<EOF
,s/php3/php/g
wp
EOF
done

:)

Stig
-- 
brautaset.org

-- 
Gllug mailing list  -  Gllug at linux.co.uk
http://list.ftech.net/mailman/listinfo/gllug




More information about the GLLUG mailing list