Date: Fri, 23 Dec 2005 16:53:59 +0200 From: Nikos Vassiliadis <nvass@teledome.gr> To: freebsd-questions@freebsd.org Subject: Re: what's an equivalent for the following Perl one-liner? Message-ID: <200512231653.59120.nvass@teledome.gr> In-Reply-To: <200512211704.49530.mi%2Bmx@aldan.algebra.com> References: <200512211704.49530.mi%2Bmx@aldan.algebra.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512231653.59120.nvass>