[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sed trouble: "\'a to á" etc



On Fri, Feb 06, 2004 at 04:47:07PM -0500, Antonio Rodriguez wrote:
> 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

You're trying to put single quotes inside single quotes, which won't
work. Also, \ doesn't need to be doubled inside single quotes: every
character inside '' apart from ' itself is interpreted literally.

The first sed expression should read like this:

  's/\'\''s/á/g'

You write ' as '\'' because what you're doing is leaving the quotes,
inserting just one ' character with \', and then re-entering the quotes.

HTH,

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: