in reply to Converting a passage of Spanish into hyphens and spaces
See perlre and perlrecharclass for what the parts in a regular expression mean.
\S means "any non-whitespace", but you don't want that, you want "any alphabetical character". I don't know what encoding your text is in, but if it is Latin-1, the following will work:
perl -pi -e 's/[a-z]/-/gi'
If your text file is encoded as (for example) UTF-8 or Unicode, I'm not sure if a oneliner will work. The following is untested but could work:
perl -CIO -pi -e 's/[[:alpha:]]/-/gi'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Converting a passage of Spanish into hyphens and spaces
by UKhombre (Initiate) on Sep 13, 2015 at 12:44 UTC | |
by Corion (Patriarch) on Sep 13, 2015 at 12:46 UTC | |
by UKhombre (Initiate) on Sep 13, 2015 at 13:50 UTC | |
by shmem (Chancellor) on Sep 13, 2015 at 15:23 UTC | |
by UKhombre (Initiate) on Sep 13, 2015 at 19:32 UTC | |
by hippo (Archbishop) on Sep 13, 2015 at 15:28 UTC | |
by UKhombre (Initiate) on Sep 13, 2015 at 19:28 UTC |