[NTLUG:Discuss] "find -exec" -vs xargs -OR- subshells in -exec

Fred James fredjame at fredjame.cnc.net
Fri May 26 09:50:02 CDT 2006


Richard Geoffrion wrote:

>I'm trying to rename a bunch of mangled files.  I want to replace all of 
>the tilde (~) characters with dashes (-).
>(some text omitted)
>Suggestions?
>
>  
>
Richard Geoffrion
Would something like this help?
Regards
Fred James

#! /bin/sh
#
for oldname in `ls -1 *~*`
do
        newname=`echo $oldname | sed y#~#-#`
        mv $oldname $newname
done
exit





More information about the Discuss mailing list