what's an equivalent for the following Perl one-liner?
Tijl Coosemans
tijl at ulyssis.org
Thu Dec 22 11:46:27 PST 2005
On Thursday 22 December 2005 20:14, Mikhail Teterin wrote:
> четвер 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 :-(
Try col(1) or tr(1) to remove the carriage return and then sed to remove
the spaces.
More information about the freebsd-questions
mailing list