title: Replacing Foreign Characters with English Equivalents in filenames with UNIX Bash Script
body: <p>I'm trying to use sed to process a list of filenames and replace every foreign character in the file name with an English equivelent.  E.g. </p>
  
  <p>málaga.txt ->  malaga.txt</p>
  
  <p>My script is the following:</p>
  
  <pre><code>    for f in *.txt 
  do
      newf=$(echo $f | sed 'y/āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜĀÁǍÀĒÉĚÈĪÍǏÌŌÓǑÒŪÚǓÙǕǗǙǛ/aaaaeeeeiiiioooouuuuüüüüAAAAEEEEIIIIOOOOUUUUÜÜÜÜ/')
      mv $f $newf
  done
  </code></pre>
  
  <p>This currently has no effect on the filenames.  However if I use the same regex to process a text file.  E.g.</p>
  
  <pre><code>cat blah.txt | sed 'y/āáǎàēéěèīíǐìōóǒòūúǔùǖǘǚǜĀÁǍÀĒÉĚÈĪÍǏÌŌÓǑÒŪÚǓÙǕǗǙǛ/aaaaeeeeiiiioooouuuuüüüüAAAAEEEEIIIIOOOOUUUUÜÜÜÜ/
  </code></pre>
  
  <p>It works perfectly - all foreign characters are substituted with their English equivalents.  Any help would be greatly appreciated. This is on Mac OsX in a UNIX shell.  </p>