GNU bug report logs - #22568
"grep ... | tee file" drops the 'n' in its output

Previous Next

Package: coreutils;

Reported by: oldefoxx <oldefoxx <at> cox.net>

Date: Fri, 5 Feb 2016 21:45:02 UTC

Severity: normal

Tags: moreinfo

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22568 in the body.
You can then email your comments to 22568 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#22568; Package coreutils. (Fri, 05 Feb 2016 21:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to oldefoxx <oldefoxx <at> cox.net>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 05 Feb 2016 21:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: oldefoxx <oldefoxx <at> cox.net>
To: bug-coreutils <at> gnu.org
Subject: "grep ... | tee file" drops the 'n' in its output
Date: Fri, 5 Feb 2016 15:41:49 -0600
Odd problem.  Seems to be partly tied to when IFS=\n is used for 
handling read statements.  Can't find a way around it that works 
reliably, so forced to use
    grep  ... > file; cat file
or
    grep ... >> tmp; cat tmp; cat tmp >> file; rm tmp

Not near as clean and elegant, and is always after the act, not during it.

I tried variances on several comands like cat, list, echo, and tee is 
really quite unique in what it does.  A simple concept, but a great tool 
for what it accomplishes.

Donald Darden




Information forwarded to bug-coreutils <at> gnu.org:
bug#22568; Package coreutils. (Fri, 05 Feb 2016 22:03:02 GMT) Full text and rfc822 format available.

Message #8 received at 22568 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: oldefoxx <oldefoxx <at> cox.net>
Cc: 22568 <at> debbugs.gnu.org
Subject: Re: bug#22568: "grep ... | tee file" drops the 'n' in its output
Date: Fri, 05 Feb 2016 23:02:11 +0100
oldefoxx <oldefoxx <at> cox.net> writes:

> IFS=\n

This is the same as IFS=n.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-coreutils <at> gnu.org:
bug#22568; Package coreutils. (Fri, 05 Feb 2016 22:06:02 GMT) Full text and rfc822 format available.

Message #11 received at 22568 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: oldefoxx <oldefoxx <at> cox.net>, 22568 <at> debbugs.gnu.org
Subject: Re: bug#22568: "grep ... | tee file" drops the 'n' in its output
Date: Fri, 5 Feb 2016 15:05:24 -0700
[Message part 1 (text/plain, inline)]
On 02/05/2016 02:41 PM, oldefoxx wrote:
> Odd problem.  Seems to be partly tied to when IFS=\n is used for

You didn't provide enough context for us to see what you were actually
typing.  But if you really typed:

IFS=\n
....stuff....

then that's the same as if you had typed:

IFS=n

which tells the shell to treat 'n' (and only 'n') as the character to
use during word splitting.  And that's a rather unusual use of IFS.

Did you mean to type:

IFS=$'\n'

as a way to limit IFS to just newlines?  Compared to the usual default
IFS of $' \t\n'?

> handling read statements.  Can't find a way around it that works
> reliably, so forced to use
>     grep  ... > file; cat file

It's not obvious how grep, cat, or tee fit into the picture here.
Without seeing the full shell script you are running, it is very hard to
say what exactly went wrong for you, but in all likelihood, it is NOT a
bug in 'tee' nor in 'grep', but a case of the shell doing exactly what
you told it to.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#22568; Package coreutils. (Thu, 25 Oct 2018 15:37:01 GMT) Full text and rfc822 format available.

Message #14 received at 22568 <at> debbugs.gnu.org (full text, mbox):

From: Assaf Gordon <assafgordon <at> gmail.com>
To: 22568 <at> debbugs.gnu.org
Subject: Re: bug#22568: "grep ... | tee file" drops the 'n' in its output
Date: Thu, 25 Oct 2018 09:36:47 -0600
tags 22568 moreinfo
close 22568
stop

(triaging old bugs)

On Fri, Feb 05, 2016 at 03:05:24PM -0700, Eric Blake wrote:
> On 02/05/2016 02:41 PM, oldefoxx wrote:
> > Odd problem.  Seems to be partly tied to when IFS=\n is used for
> 
> It's not obvious how grep, cat, or tee fit into the picture here.
> Without seeing the full shell script you are running, it is very hard to
> say what exactly went wrong for you, but in all likelihood, it is NOT a
> bug in 'tee' nor in 'grep', but a case of the shell doing exactly what
> you told it to.
> 

With no further comments in 2 years, I'm closing this bug.
Discussion can continue by replying to this thread.

-assaf





Added tag(s) moreinfo. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 25 Oct 2018 15:37:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 22568 <at> debbugs.gnu.org and oldefoxx <oldefoxx <at> cox.net> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 25 Oct 2018 15:37:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 23 Nov 2018 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.