Remove spanish accent from file name


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Remove spanish accent from file name
# 1  
Old 04-27-2011
Remove spanish accent from file name

Hello All
hope all fine,

I have a question about spanish accents...
I have in a redhat server, a lot of files with Ñ or Ú accent into the NAME of the file.
So my question is: Is it possible to change this name but with a script...to change all the occurence in one shot.

Exemple:

Code:
 
cd /home/
ls
españa1.txt
españa2.txt
españa3.txt
chímica.txt

The result should be:
Code:
 
espana1.txt
espana2.txt
espana3.txt
chimica.txt

Is it possible?
maybe a sed into a bucle?
Thanks a lot in advance
# 2  
Old 04-27-2011
Code:
for f in `ls -1`; do
    tmp_f=`echo $f | tr "ÑÚíñ" "NUin"`
    if [ "$tmp_f" != "$f" ]; then
        mv $f $tmp_f
        echo "$f is renamed to $tmp_f"
    fi
done

Note: the code is not tested.
# 3  
Old 04-27-2011
Hi
thanks a lot for the script, tomorrow I'll send the result.
Have a nice day.
Cheers
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Spanish Shell script

Question,Anyone I found a script on github that I like it executes find but every word on the screen is in spainish ...other than learning Spanish...is there language translating software that will work on bash shell script to change it to English..?? large file has 4500 lines of code 254kb:wall:... (1 Reply)
Discussion started by: bmark109
1 Replies

2. AIX

Accent words file from windows

Hi guys, I'm having a issue with a windows file from, at first the file is readed like one big and extense line and the famous "Ctrl+V Ctrl+R" or "^M return carriage"... fixed with: perl -pe 'if ( s/\r\n?/\n/g ) { $f=1 }; if ( $f || ! $m ) { s/()\z/$1\n/ }; $m=1' $file_input > file_output ... (5 Replies)
Discussion started by: jockx
5 Replies

3. HP-UX

Problem with sftp for accent character files

Hi All, Following are the problems i am facing.Resolution for these would be highly commendable: a)I am trying to transfer files from my local C: directory to unix server using sftp. The problem is coming when files with accent characters are picked for transfer.These files are not... (6 Replies)
Discussion started by: destinykrishan
6 Replies

4. Shell Programming and Scripting

Spanish accent symbol removed by sed

Hello All in a text file I have to replace some numeric code by a string. This is an exemple of the file: 000000001 LDR L ^^^^^nam^^2200169Ia^45e0 000000001 008 L 100604s9999^^^^xx^^^^^^^^^^^^000^0^und^d 000000001 022 L $$a0365-6675 000000001 090 L $$aBMA 1934-1937. 000000001 245... (1 Reply)
Discussion started by: ldiaz2106
1 Replies

5. Shell Programming and Scripting

HI Newbi in Unix (spanish)

Mi idea es crear un pequeña shell...lo que pasa es que cuando ejecuto el siguiente programa va todo bien hasta que me salta el error perror("Error al ejecutar la función execvp\n"); Entonces la aplicación me entra en un bucle(repitiendo todo el rato el error anterio), como puedo hacer para que eso no... (1 Reply)
Discussion started by: isnhatar
1 Replies

6. UNIX for Dummies Questions & Answers

Keyboard/Spanish

I am looking for information to find out the easiest way to have my keyboard be able to do Spanish punctuation marks when typing in word processing in Open Office....... (0 Replies)
Discussion started by: scuup
0 Replies

7. UNIX for Dummies Questions & Answers

viewing spanish file in vi editor

hi, I have a file in unix which contains spanish entries When I try to open the file in vi editor i can see some spaces as shown below when I ftp the same file and see in my machine i can see it clearly what settings i can use while viewing the file in vi plz find some snapshot of the... (1 Reply)
Discussion started by: trichyselva
1 Replies

8. Shell Programming and Scripting

Sed accent

Hi everyone ! I'd like to write a unix command for correcting all european accent errors in a document (spanish, german, french, danisch, etc )! i need to do this for correcting my document : sed -e 's/%2B/\ /g' -e 's/%25C9/É/g' doc1 > doc2 The first command is ok and change "%2B" into... (3 Replies)
Discussion started by: Tomat75
3 Replies

9. UNIX for Dummies Questions & Answers

accent in emacs

Hello, I try to insert charcheters with accent with emacs. It doesn't work. How can I do ? Thank you in advance (2 Replies)
Discussion started by: annemar
2 Replies
Login or Register to Ask a Question