From unknown Sat Aug 16 21:19:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22568: "grep ... | tee file" drops the 'n' in its output Resent-From: oldefoxx Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 05 Feb 2016 21:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22568 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 22568@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.145470865320578 (code B ref -1); Fri, 05 Feb 2016 21:45:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Feb 2016 21:44:13 +0000 Received: from localhost ([127.0.0.1]:34823 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aRoAn-0005Lq-4V for submit@debbugs.gnu.org; Fri, 05 Feb 2016 16:44:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35437) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aRo8s-0005Hb-NZ for submit@debbugs.gnu.org; Fri, 05 Feb 2016 16:42:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRo8m-0006Qy-T7 for submit@debbugs.gnu.org; Fri, 05 Feb 2016 16:42:09 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41608) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRo8m-0006Qu-QA for submit@debbugs.gnu.org; Fri, 05 Feb 2016 16:42:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRo8m-0006lL-2Q for bug-coreutils@gnu.org; Fri, 05 Feb 2016 16:42:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRo8i-0006Pz-1y for bug-coreutils@gnu.org; Fri, 05 Feb 2016 16:42:07 -0500 Received: from eastrmfepo201.cox.net ([68.230.241.216]:56437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRo8h-0006Pl-Qv for bug-coreutils@gnu.org; Fri, 05 Feb 2016 16:42:03 -0500 Received: from eastrmimpo109 ([68.230.241.222]) by eastrmfepo201.cox.net (InterMail vM.8.01.05.15 201-2260-151-145-20131218) with ESMTP id <20160205214201.EUAX18342.eastrmfepo201.cox.net@eastrmimpo109> for ; Fri, 5 Feb 2016 16:42:01 -0500 Received: from [192.168.1.145] ([98.162.157.241]) by eastrmimpo109 with cox id Elhp1s00C5Cmr2y01lhqxl; Fri, 05 Feb 2016 16:41:50 -0500 X-CT-Class: Clean X-CT-Score: 0.00 X-CT-RefID: str=0001.0A020202.56B51729.0018,ss=1,re=0.000,fgs=0 X-CT-Spam: 0 X-Authority-Analysis: v=2.0 cv=FIzFMZUs c=1 sm=1 a=iR1OVfX4W0Rcvtw4DwTrww==:17 a=qmg6_wsJunecno9xZyYA:9 a=QEXdDO2ut3YA:10 a=iR1OVfX4W0Rcvtw4DwTrww==:117 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (CRAM-MD5) smtp.auth=oldefoxx@cox.net From: oldefoxx Message-ID: <56B5171D.6050509@cox.net> Date: Fri, 5 Feb 2016 15:41:49 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.4 (----) X-Mailman-Approved-At: Fri, 05 Feb 2016 16:44:11 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.4 (----) 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 From unknown Sat Aug 16 21:19:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22568: "grep ... | tee file" drops the 'n' in its output Resent-From: Andreas Schwab Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 05 Feb 2016 22:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22568 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: oldefoxx Cc: 22568@debbugs.gnu.org Received: via spool by 22568-submit@debbugs.gnu.org id=B22568.145470973528490 (code B ref 22568); Fri, 05 Feb 2016 22:03:02 +0000 Received: (at 22568) by debbugs.gnu.org; 5 Feb 2016 22:02:15 +0000 Received: from localhost ([127.0.0.1]:34853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aRoSF-0007PS-KT for submit@debbugs.gnu.org; Fri, 05 Feb 2016 17:02:15 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:35271) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aRoSE-0007PK-AB for 22568@debbugs.gnu.org; Fri, 05 Feb 2016 17:02:14 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3pxrM90pc0z3hj0M; Fri, 5 Feb 2016 23:02:13 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3pxrM902gvzvh28; Fri, 5 Feb 2016 23:02:12 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id FQsVISuPJJiF; Fri, 5 Feb 2016 23:02:12 +0100 (CET) X-Auth-Info: X643ldLUurhFuATmaw4XKR5/DSWQXLoZh3Ggkte2QSgx3Us7kSN5Qlf3fkGk4r2p Received: from igel.home (host-188-174-219-146.customer.m-online.net [188.174.219.146]) by mail.mnet-online.de (Postfix) with ESMTPA; Fri, 5 Feb 2016 23:02:12 +0100 (CET) Received: by igel.home (Postfix, from userid 1000) id 2DA5B2C4A2B; Fri, 5 Feb 2016 23:02:11 +0100 (CET) From: Andreas Schwab References: <56B5171D.6050509@cox.net> X-Yow: Are we on STRIKE yet? Date: Fri, 05 Feb 2016 23:02:11 +0100 In-Reply-To: <56B5171D.6050509@cox.net> (oldefoxx@cox.net's message of "Fri, 5 Feb 2016 15:41:49 -0600") Message-ID: <87zivelst8.fsf@linux-m68k.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) oldefoxx writes: > IFS=\n This is the same as IFS=n. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From unknown Sat Aug 16 21:19:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22568: "grep ... | tee file" drops the 'n' in its output Resent-From: Eric Blake Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 05 Feb 2016 22:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22568 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: oldefoxx , 22568@debbugs.gnu.org Received: via spool by 22568-submit@debbugs.gnu.org id=B22568.145470993428774 (code B ref 22568); Fri, 05 Feb 2016 22:06:02 +0000 Received: (at 22568) by debbugs.gnu.org; 5 Feb 2016 22:05:34 +0000 Received: from localhost ([127.0.0.1]:34857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aRoVS-0007U2-32 for submit@debbugs.gnu.org; Fri, 05 Feb 2016 17:05:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44787) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aRoVQ-0007Tm-Fz for 22568@debbugs.gnu.org; Fri, 05 Feb 2016 17:05:33 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id DF91F5A4C; Fri, 5 Feb 2016 22:05:26 +0000 (UTC) Received: from [10.3.113.164] (ovpn-113-164.phx2.redhat.com [10.3.113.164]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u15M5Prk001534; Fri, 5 Feb 2016 17:05:26 -0500 References: <56B5171D.6050509@cox.net> From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <56B51CA4.1080101@redhat.com> Date: Fri, 5 Feb 2016 15:05:24 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <56B5171D.6050509@cox.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="dt6H7g0G9uEC0t6x8GID30ntVATJC6Vb4" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Spam-Score: -5.4 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.4 (-----) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --dt6H7g0G9uEC0t6x8GID30ntVATJC6Vb4 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/05/2016 02:41 PM, oldefoxx wrote: > Odd problem. Seems to be partly tied to when IFS=3D\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=3D\n =2E...stuff.... then that's the same as if you had typed: IFS=3Dn 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=3D$'\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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --dt6H7g0G9uEC0t6x8GID30ntVATJC6Vb4 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWtRykAAoJEKeha0olJ0NqONIH/jgfHNzK/e4cw/ISEBMi/1tb KfwgAfdK0uxvMCPdzKL1zPa6qu9w4yKSq4/3ckvhMJZJkv0K1nUOj/81u1LcAaBC 0YARFry75NIdI0tvwhYAso6gvI7JX1Jvb7lTAM/3X4HkmnyJTy0Fksb7rAwC1oj4 9+Fm2uNOaljtz7x23Z/OYfF0V3lSR7tR5qK7ysNyv5twT0KzEsEYomovychKtObE wnjp3rdWDlX24ssiMBTD3/AeX9GBMOzoF22DKSuS5gAQBSekan6JuljYVVD24U66 XCQdHwPvpJ6B9GBCR/MdWVuLLWi5W9IBEb3ogwasbzJkhmjbltazBsu/c3JlCjk= =5Q/Z -----END PGP SIGNATURE----- --dt6H7g0G9uEC0t6x8GID30ntVATJC6Vb4-- From unknown Sat Aug 16 21:19:07 2025 X-Loop: help-debbugs@gnu.org Subject: bug#22568: "grep ... | tee file" drops the 'n' in its output Resent-From: Assaf Gordon Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 25 Oct 2018 15:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22568 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 22568@debbugs.gnu.org Received: via spool by 22568-submit@debbugs.gnu.org id=B22568.15404818196610 (code B ref 22568); Thu, 25 Oct 2018 15:37:01 +0000 Received: (at 22568) by debbugs.gnu.org; 25 Oct 2018 15:36:59 +0000 Received: from localhost ([127.0.0.1]:42624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFhgw-0001iX-VO for submit@debbugs.gnu.org; Thu, 25 Oct 2018 11:36:59 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:35598) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFhgv-0001iH-Pg; Thu, 25 Oct 2018 11:36:58 -0400 Received: by mail-it1-f193.google.com with SMTP id p64-v6so2313412itp.0; Thu, 25 Oct 2018 08:36:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=oY8L9pMWsqb5A+IDLet1mYxiA+rXxEaQcQAOvnPNSi4=; b=RtAc/hD9L1e9vHJJUb03YAPiYN0WDZ1gbj33+2/Pnwg9MZKtEWfgY2C9Aerm919JBR WyPgVlGeL1DK8qGWG+tl5OZ+RaabSjCB3NMIF0A2Ex1rnV1JhUW5o4hL2DbH3gE4HjGu 3rB1AGXxC+QeAZ9YRgqCqhMIGeUpVNC6wRakyXf2hEzRzoYEOa4kquCqd9MXiXH4TBhV fcjrI8Btf4hd8C7qTNcZgo/abFZZvZ6/WR2hlb2um9w9sWQbc9Xvo9HbBCyLKRBYzeYS anHWPaoicIMP3qsPFEZ6w/d+5vS6mPpjI9BKll61v3EDJP7gKzs4txjjAJBAxX6xvpW2 7zVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=oY8L9pMWsqb5A+IDLet1mYxiA+rXxEaQcQAOvnPNSi4=; b=KSClSHEvI1i2tSuCSPdN6h1qgT+mIiRcPTDBS1NqDlHZfa4RRqnlVJ2r6Uil6kbPq2 nZ1mkcZKumAoaZGZwrvNx5hQTBrcA4UTWBqbRK7CwCwjVdZ1R1es+Aye603ohkTxekKT cmc+66tGQN59Rlz9gjwATbjiHjQiRp2N08VxMR3tIVbZcF/ldxY0PNEd3wHYo/qxQkBW cigP4KTsHILr9LjboO3j5bvX1lwZ2yNHJvlkEXceOokBXXY5L45N8YePrdmnL9eEfQPm EmJuOMQhQ+jGjhljhJKTSp1qQiItyR82dFL6CqRpO5JLucUCSzztcR5iMA5zKeKzgRGq aQcw== X-Gm-Message-State: AGRZ1gLFpUxG85Hv2zEHLmzpYYeU3BDW81WYtPMKH0auZqtBJVEy5Rpl JibMvFvTTGG5HT22pSSvS7k3KwZ+ X-Google-Smtp-Source: AJdET5dCgwj78DqZQ8fHtsdcRRAr5hFYkS7+QjKdJ7A31HcZVxMoL6J9cSTJj/1qsyvLwuocsy4F1w== X-Received: by 2002:a02:a391:: with SMTP id y17-v6mr1412354jak.78.1540481811548; Thu, 25 Oct 2018 08:36:51 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.gmail.com with ESMTPSA id 186-v6sm387992itf.11.2018.10.25.08.36.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Oct 2018 08:36:50 -0700 (PDT) Date: Thu, 25 Oct 2018 09:36:47 -0600 From: Assaf Gordon Message-ID: <20181025153647.62g2elnwccwwl6ns@tomato.housegordon.com> References: <56B5171D.6050509@cox.net> <56B51CA4.1080101@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56B51CA4.1080101@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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