From owner-freebsd-questions@FreeBSD.ORG Fri Oct 9 19:19:39 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 6B7491065676 for ; Fri, 9 Oct 2009 19:19:39 +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 275968FC1E for ; Fri, 9 Oct 2009 19:19:38 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.3/8.14.3) with ESMTP id n99JJcR3029268; Fri, 9 Oct 2009 13:19:38 -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 n99JJcEB029265; Fri, 9 Oct 2009 13:19:38 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Fri, 9 Oct 2009 13:19:38 -0600 (MDT) From: Warren Block To: Oliver Fromme In-Reply-To: <200910091829.n99ITRFG031873@lurza.secnetix.de> Message-ID: References: <200910091829.n99ITRFG031873@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 13:19:38 -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 19:19:39 -0000 On Fri, 9 Oct 2009, Oliver Fromme wrote: > Warren Block wrote: > > > > Certainly \x will not help in sed; sed doesn't have it. > > Right, that's an annoying flaw in sed (it doesn't even > support the \0 syntax for octal values, which is more > standard than \x). >From my perspective, sed is a tiny, gooey center of usefulness nearly completely obscured by annoying flaws. That's not fair to sed, since most of its flaws can be more fairly described as legacy behavior. > Maybe the OP should configure his software to not save the > file with UTF-8 encoding in the first place. I'm not an > OOo user, so I can't tell how to do that. But obviously > the OP doesn't want the file to be stored as UTF-8. Sure. That removes the need for any of these tools. > > It's possible "Mastering Regular Expressions" has influenced my thinking > > on this. > > This isn't about regular expressions at all. This is > about replacing fixed strings. The OP was using a regex. But my question was "why sed instead of Perl?" tr(1) was also suggested, and is probably better than sed in this case. Of course, tr is another tool that Perl can replace with added functionality. Likewise Ruby, which has about the same command-line options as Perl but is less likely to be installed on a typical FreeBSD system. -Warren Block * Rapid City, South Dakota USA