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.

Full log


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)]

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.