From owner-freebsd-questions@FreeBSD.ORG Fri Oct 9 13:47:38 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E9B2106568D for ; Fri, 9 Oct 2009 13:47:38 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id 3F1548FC12 for ; Fri, 9 Oct 2009 13:47:37 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.3/8.14.3) with ESMTP id n99Dlbi4028082; Fri, 9 Oct 2009 07:47:37 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.3/8.14.3/Submit) with ESMTP id n99DlbB4028079; Fri, 9 Oct 2009 07:47:37 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Fri, 9 Oct 2009 07:47:37 -0600 (MDT) From: Warren Block To: Oliver Fromme In-Reply-To: <200910091026.n99AQPUv014685@lurza.secnetix.de> Message-ID: References: <200910091026.n99AQPUv014685@lurza.secnetix.de> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (wonkity.com [127.0.0.1]); Fri, 09 Oct 2009 07:47:37 -0600 (MDT) Cc: freebsd-questions@freebsd.org Subject: Re: for perl wizards. X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Oct 2009 13:47:38 -0000 On Fri, 9 Oct 2009, Oliver Fromme wrote: > 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 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