Skip site navigation (1)Skip section navigation (2)
Date:      12 Dec 2006 20:50:04 -0000
From:      John Levine <johnl@iecc.com>
To:        freebsd-questions@freebsd.org
Cc:        kline@tao.thought.org
Subject:   Re: can I use perl substitution to handle hex chars?
Message-ID:  <20061212205004.35548.qmail@simone.iecc.com>
In-Reply-To: <20061212063808.GA31424@thought.org>

next in thread | previous in thread | raw e-mail | index | archive | help
>	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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061212205004.35548.qmail>