Modified to only changed last occurence of string.
1 parent f0340a3 commit 8fc9984eca4cd3f1499181962f5f4cf2901c1ae1
@root root authored on 8 Feb 2006
Showing 1 changed file
View
12
renext
#!/bin/sh
# renext - Mass File Rename By "Extension"
# Copyright (c) 2006 TundraWare Inc., Des Plaines, IL USA
# All Rights Reserved
# $Id: renext,v 1.101 2006/02/09 00:13:13 root Exp $
# $Id: renext,v 1.102 2006/02/09 00:56:42 root Exp $
 
if [ $# != 2 ]
then
echo "usage: renext oldext newext"
echo " Renames files ending with '.oldext' to end with '.newext'"
 
else
for f in *$1
do
tgt=`echo $f | sed s/\.$1/\.$2/`
echo $f $tgt
done
for f in *.${1}
do
tgt=`echo $f | sed s/\.$1$/\.$2/`
echo $f $tgt
done
 
fi