coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tee: add --remove-cr option


From: Nikos Papaspyrou
Subject: Re: tee: add --remove-cr option
Date: Wed, 9 Feb 2022 09:14:34 +0100

On Wed, Feb 9, 2022 at 8:30 AM Bernhard Voelker
<mail@bernhard-voelker.de> wrote:
>
> On 2/9/22 04:27, Nikos Papaspyrou wrote:
> > Notice that the LOG file contains more than can be seen in the standard
> > output. Three lines were printed with progress information, each starting
> > with a carriage return character (0d). Only the last one remained and can
> > be seen in the standard output. This is frustrating if one needs to edit
> > or otherwise process the LOG file.
>
> What's wrong with
>   $ tr -d '\r' < LOG
> or
>   $ tr '\r' '\n' < LOG
> to show the output on the terminal later again?

If one settles to filter the LOG after it's saved, the intended behavior
is to remove these lines. So it would be something like:

$ cat LOG | sed 's/\r/@REMOVE\n/g' | sed '/@REMOVE$/d'

> > More specifically, lines ending with carriage return are sent to the
> > standard output but not to the files.
>
> -1
> IMO it's not tee(1)'s business to modify the content it is streaming.

This is a fair comment and in principle I can only agree. However, if the
intended behavior is to send something different to the LOG file from what
goes to the standard output, there's no easy way to obtain it unless sed
implements it.

-- 
Nikolaos Papaspyrou
Software Engineer
nikolaos@google.com

Google Germany GmbH
Erika-Mann-Strasse 33
80636 Muenchen

Geschaeftsfuehrer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Falls Sie diese faelschlicherweise
erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes
weiter, loeschen Sie alle Kopien und Anhaenge davon und lassen Sie
mich bitte wissen, dass die E-Mail an die falsche Person gesendet
wurde.

This e-mail is confidential. If you received this communication by
mistake, please don't forward it to anyone else, please erase all
copies and attachments, and please let me know that it has gone to the
wrong person.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]