From owner-freebsd-questions@FreeBSD.ORG Thu Dec 22 19:14:24 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6FFAC16A41F for ; Thu, 22 Dec 2005 19:14:24 +0000 (GMT) (envelope-from mi+mx@aldan.algebra.com) Received: from vms040pub.verizon.net (vms040pub.verizon.net [206.46.252.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id E033643D45 for ; Thu, 22 Dec 2005 19:14:23 +0000 (GMT) (envelope-from mi+mx@aldan.algebra.com) Received: from corbulon.video-collage.com ([151.204.231.237]) by vms040.mailsrvcs.net (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPA id <0IRW00GMIYRYTQQB@vms040.mailsrvcs.net> for freebsd-questions@freebsd.org; Thu, 22 Dec 2005 13:14:23 -0600 (CST) Received: from mteterin.us.murex.com (195-11.customer.cloud9.net [168.100.195.11]) by corbulon.video-collage.com (8.13.4/8.13.1) with ESMTP id jBMJEKj2044024 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 22 Dec 2005 14:14:22 -0500 Received: from mteterin.us.murex.com (mteterin@localhost [127.0.0.1]) by mteterin.us.murex.com (8.13.4/8.13.4) with ESMTP id jBMJEEA1031776; Thu, 22 Dec 2005 14:14:14 -0500 Received: from localhost (localhost [[UNIX: localhost]]) by mteterin.us.murex.com (8.13.4/8.13.4/Submit) id jBMJEA2J031771; Thu, 22 Dec 2005 14:14:10 -0500 Date: Thu, 22 Dec 2005 14:14:09 -0500 From: Mikhail Teterin In-reply-to: <20051222183250.GB39217@dan.emsphone.com> To: Dan Nelson Message-id: <200512221414.10321.mi+mx@aldan.algebra.com> Organization: Virtual Estates, Inc. MIME-version: 1.0 Content-type: text/plain; charset=koi8-u Content-transfer-encoding: 8BIT Content-disposition: inline X-Virus-Scanned: ClamAV devel-20050525/1213/Mon Dec 19 09:48:34 2005 on corbulon.video-collage.com X-Virus-Status: Clean X-Scanned-By: MIMEDefang 2.43 References: <200512211704.49530.mi+mx@aldan.algebra.com> <20051222183250.GB39217@dan.emsphone.com> X-Authentication-warning: mteterin.us.murex.com: mteterin set sender to mi+mx@aldan.algebra.com using -f User-Agent: KMail/1.8.3 Cc: freebsd-questions@freebsd.org Subject: Re: what's an equivalent for the following Perl one-liner? 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: Thu, 22 Dec 2005 19:14:24 -0000 четвер 22 грудень 2005 13:32, Dan Nelson Ви написали: > In the last episode (Dec 21), Mikhail Teterin said: > > I'd like a sed string, that will remove both the carriage returns and > > the blanks at eol in one go. Perl appears to recognize the \r > > character and DTRT: > > > > perl -p -e 's,[ \r]+$,,' < in > out > > > > What's the sed's equivalent? Thanks! > > sed -E 's,[ ^M]*$,,' < in > out > > Note the ^M is a single control-character (entered via Ctrl-V Ctrl-M at > a shell prompt for example). Yes, I used this in the past, but the ports' Makefiles are supposed to be ASCII-only :-( > sed does not parse backslash-escapes except for \n which represents a > newline. Is not that a bug really? There may be some legacy reasons not to do it by default, but I'd expect the -E flag to turn on the recognition of such symbols... Thanks! -mi