for perl wizards.

Lars Eighner luvbeastie at larseighner.com
Fri Oct 9 09:46:42 UTC 2009


On Fri, 9 Oct 2009, Gary Kline 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're kidding, aren't you?  The apostrophe is the same as the single quote,
so double quote the execute line.  Also, of course, you haven't specified
which file(s) to operate on.  And finally, there are tons of perl forums,
mailing lists, and newsgroups.  Pick one to ask perl questions.

   	perl -pi.bak -e "s/\xe2\x80\x99/'/g" OOo

> 	If there any another other tools, I'm interested!

check out sed and tr.

-- 
Lars Eighner
http://www.larseighner.com/index.html
8800 N IH35 APT 1191 AUSTIN TX 78753-5266



More information about the freebsd-questions mailing list