From owner-freebsd-questions@FreeBSD.ORG Fri Dec 23 14:57:22 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 3055316A420 for ; Fri, 23 Dec 2005 14:57:22 +0000 (GMT) (envelope-from nvass@teledome.gr) Received: from matrix.teledomenet.gr (dns1.teledomenet.gr [213.142.128.1]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1153C43D79 for ; Fri, 23 Dec 2005 14:57:18 +0000 (GMT) (envelope-from nvass@teledome.gr) Received: from iris ([192.168.1.71]) by matrix.teledomenet.gr (8.12.10/8.12.10) with ESMTP id jBNEvDkA023739 for ; Fri, 23 Dec 2005 16:57:14 +0200 From: Nikos Vassiliadis To: freebsd-questions@freebsd.org Date: Fri, 23 Dec 2005 16:53:59 +0200 User-Agent: KMail/1.8.1 References: <200512211704.49530.mi+mx@aldan.algebra.com> In-Reply-To: <200512211704.49530.mi+mx@aldan.algebra.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200512231653.59120.nvass@teledome.gr> 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: Fri, 23 Dec 2005 14:57:22 -0000 On Thursday 22 December 2005 00:04, Mikhail Teterin wrote: > 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! I thought only bash could do it, but I was wrong: a=$'s/[ \r]\{1,\}$//' sed "$a" the shell will expand $'\r' to errr \r and you can use as an one-liner var=value sed "$var" HTH, Nikos > > -mi > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org"