The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 05-30-2007
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,423
If one character is to be replaced by another character (just one), you can do something like that (the echo is for debug purpose):
Code:
#!/usr/bin/ksh
# ScriptFile: special_rename
from='àéêèïù'
  to='aeeeiu'
ls *[${from}]* |
while read filename
do
   echo mv ${filename} $(echo ${filename} | tr "$from" "$to")
done
Execution:
Code:
$ touch téléphone à_voir
$ special_rename
mv téléphone telephone
mv à_voir a_voir
$
Jean-Pierre.