can I use perl substitution to handle hex chars?

John Levine johnl at iecc.com
Tue Dec 12 12:50:13 PST 2006


>	Seems like lots of files I get off the net use \x80\x98 or the
>	like to denote various non-ascii characters.  Is there a way to
>	use perl (or any other unix tool) to replace
>	\x<whatever>\x<whatever> with, say whatever ASCII or ISO-8859-1
>	character or characters?

perl -pe 's/\\x(\w\w)/chr(hex("$1"))/eg'

R's,
John




More information about the freebsd-questions mailing list