in reply to Re: Converting a passage of Spanish into hyphens and spaces
in thread Converting a passage of Spanish into hyphens and spaces

Thank you Corion. My piece of text was saved in UTF-8. I couldn't get either command to work. I tried saving a text file in Western ISO Latin 1. Is that the same as Latin-1? Anyway I couldn't get that to work either. Dumb question: if I pasted some error messages does that tell you everything you need to know?
  • Comment on Re^2: Converting a passage of Spanish into hyphens and spaces

Replies are listed 'Best First'.
Re^3: Converting a passage of Spanish into hyphens and spaces
by Corion (Patriarch) on Sep 13, 2015 at 12:46 UTC

    I'm not sure if that will tell me everything I need to know, but the error messages will certainly help diagnose it better.

      I've just tried the Unicode one again and this time I got it to work. I don't know what I did differently in terms of my typing in your code plus the file name.

      Recuerdo igual que si fuera hoy el día que llegué. Había hecho el viaje en tren con otros cinco compañeros novatos, y al bajar en la estación fuimos al hotel Condal, donde habíamos reservado habitaciones.

      -------- ----- --- -- ----- --- -- -í- --- -----é. ---í- ----- -- ----- -- ---- --- ----- ----- -----ñ---- -------, - -- ----- -- -- ------ó- ------ -- ----- ------, ----- ---í---- --------- ------------.

      As you can see there's still the letters with accents but if that can't be changed no worries and thank you very much for what you've done.

        As you can see there's still the letters with accents

        Extend your character class to have these translated, too:

        [[:alpha:]áéíóúñü]
        perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

        If the encoding is utf-8 rather than iso8859-1 then you can use the XPosixAlpha class like this:

        $ echo habíamos reservado habitaciones. | perl -CIO -pe 's/\p{XPosixAl +pha}/-/g;' -------- --------- ------------.