Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Dec 2005 20:46:21 +0100
From:      Tijl Coosemans <tijl@ulyssis.org>
To:        freebsd-questions@freebsd.org
Cc:        Mikhail Teterin <mi+mx@aldan.algebra.com>
Subject:   Re: what's an equivalent for the following Perl one-liner?
Message-ID:  <200512222046.22133.tijl@ulyssis.org>
In-Reply-To: <200512221414.10321.mi%2Bmx@aldan.algebra.com>
References:  <200512211704.49530.mi%2Bmx@aldan.algebra.com> <20051222183250.GB39217@dan.emsphone.com> <200512221414.10321.mi%2Bmx@aldan.algebra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 22 December 2005 20:14, Mikhail Teterin wrote:
> =DE=C5=D4=D7=C5=D2 22 =C7=D2=D5=C4=C5=CE=D8 2005 13:32, Dan Nelson =F7=C9=
 =CE=C1=D0=C9=D3=C1=CC=C9:
> > 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 :-(

Try col(1) or tr(1) to remove the carriage return and then sed to remove=20
the spaces.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200512222046.22133.tijl>