for perl wizards.

Warren Block wblock at wonkity.com
Fri Oct 9 13:47:38 UTC 2009


On Fri, 9 Oct 2009, Oliver Fromme wrote:

> Gary Kline <kline at thought.org> wrote:
> >
> >         Whenever I save a wordpeocessoe file [OOo, say] into a
> >         text file, I get a slew of hex codes to indicate the char to be
> >         used.  I'm looking for a perl one-liner or script to translate
> >         hex back into ', ", -- [that's a dash), and so forth.  Why does
> >         this fail to trans the hex code to an apostrophe?
> >
> >         perl -pi.bak -e 's/\xe2\x80\x99/'/g'
>
> You need to escape the inner quote character, of course.
> I think sed is better suited for this task than perl.

That's twice now people have suggested sed instead of perl.  Why?  For 
many uses, perl is a better sed than sed.  The regex engine is far more 
powerful and escapes are much simpler.

-Warren Block * Rapid City, South Dakota USA


More information about the freebsd-questions mailing list