[SunHELP] script request!
Will Mc Donald
wmcdonald at ntlworld.com
Fri Sep 20 08:31:41 CDT 2002
The best I can come up with off the top of my head is...
<-------SNIP------->
#! /bin/bash
for oldname in `find . -name "*nana*pl" | cut -d '/' -f 2`
do
newname=`echo $oldname | sed 's/nana/mona/'`
# echo $newname
mv $oldname $newname
done
<-------SNIP------->
Not particularly elegant but it works. You could replace the find with an "ls
-1 *nana*pl"or something if you only wanted the current directory.
Will.
----- Original Message -----
From: "Simon Jespersen" <shj at pine.dk>
To: "Sun solaris help list" <sunhelp at sunhelp.org>
Sent: Friday, September 20, 2002 2:12 PM
Subject: [SunHELP] script request!
> Hi list!
>
> I need a script for replacing a string in a number of files in a directory
>
> i want to replace the string "nana" with the string "mona" in all *pl files
> i wonder if anybody af a script or a easy way to do that.
>
> Kind regards
> Simon Jespersen
> Project engineer
> Pine Tree Systems A/S
> Damhaven 5d
> DK-7100 Vejle
> Email: shj at pine.dk
> Phone: +4575724477
> _______________________________________________
> SunHELP maillist - SunHELP at sunhelp.org
> http://www.sunhelp.org/mailman/listinfo/sunhelp
More information about the SunHELP
mailing list