On Fri  6 Feb 2004 16:47:07 +0000(-0500), Antonio Rodriguez wrote:
> 
> #!/bin/bash
> #Trying with sed:
> #To change \'a into � and so forth
> echo "File name to process please:"
> read archivo
> cp $archivo $archivo-copia
>  
> sed -e 's/\\'a/�/g' -e 's/\\'e/�/g' -e 's/\\'{\\i}/�/g' -e 's/\\'o/�/g' -e 
> 's/\\'u/�/g' -e 's/\\'A/�/g' -e 's/\\'E/�/g' -e 's/\\'{\\I}/�/g' -e 's/\\'O/�/g' -e 
> 's/\\'U/�/g' -e 's/\\~n/�/g' -e 's/\\~N/�/g' -e 's/\\"u/�/g' -e 's/\\"U/�/g' -e 
> 's/?`/�/g' -e 's/!`/�/g' $archivo-copia > $archivo-out

Antonio,

One thing that is wrong with this is that you have misused the shell 
quotes; you have tried to use ' inside ''. You could quote the patterns 
containing ' with "" instead of '', but you would also need to double up
the \ characters and it would be rather messy. Instead, you could avoid
shell quoting by putting the sed script in a separate file, like this:

sed -f mySedScript $archivo-copia > $archivo-out

where mySedScript contains:

s/\\'a/�/g
s/\\'e/�/g

and so on.

You can even begin the script with
#!/bin/sed -f
and invoke it like this if you wish:
mySedScript $archivo-copia > $archivo-out


-- 
Cheers,
Clive


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to