PDA

View Full Version : replace character (shell script)



razzer
November 24th, 2009, 07:32 PM
Hello

Im making a shell script wich is adding users from a file where each user is sepearetd liked this

Kajsa;svensson
Tomas;brjesson

and so on, the script is in a while loop until it has done all users in the file. What i wonder is, how can i check for each time it ads a user if there is any swedish characters like "" and replace them if found? for example should be replaced with "a" and with "o"

diesch
November 24th, 2009, 08:59 PM
$ echo "" |sed 'y//aao/'
oaa

stylishpants
November 25th, 2009, 09:35 AM
Try uni2ascii.



bob@cob:~$ cat /tmp/test
Kajsa;svensson
Tomas;brjesson

bob@cob:~$ uni2ascii -Bq /tmp/test
Kajsa;svensson
Tomas;borjesson