From owner-freebsd-questions@FreeBSD.ORG Sun May 20 17:41:27 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D6779106566B for ; Sun, 20 May 2012 17:41:27 +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 5217A8FC08 for ; Sun, 20 May 2012 17:41:26 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.5/8.14.5) with ESMTP id q4KHfNUE098399; Sun, 20 May 2012 11:41:23 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.5/8.14.5/Submit) with ESMTP id q4KHfNMQ098396; Sun, 20 May 2012 11:41:23 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Sun, 20 May 2012 11:41:23 -0600 (MDT) From: Warren Block To: Polytropon In-Reply-To: <20120520182245.b04d681f.freebsd@edvax.de> Message-ID: References: <20120520182245.b04d681f.freebsd@edvax.de> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (wonkity.com [127.0.0.1]); Sun, 20 May 2012 11:41:23 -0600 (MDT) Cc: Tim Dunphy , freebsd-questions Subject: Re: eliminate character with sed 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: Sun, 20 May 2012 17:41:27 -0000 On Sun, 20 May 2012, Polytropon wrote: > Regarding the use of "sed": I'm not sure if it's possible > to do something like > > % sed -i '.bak' 's/\r//g' config.php > > because I assume (not tested!) that it's not possible to > put in escape sequences like that. But try for yourself > and surprise me. :-) A traditional way of stripping CRs is with col(1): % col < config.php > config.php-lfonly sed almost goes out of its way to make the most useful escapes unavailable, or at least unavailable where you need them. Perl makes it all available and can be used as a sed replacement: % perl -i.bak -pe 's/\r//g' config.php (Tested.)