GNU bug report logs - #37607
How to use Grep with Using -o

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: grep; Reported by: Matt Zand <mahdiumd@HIDDEN>; dated Thu, 3 Oct 2019 16:09:01 UTC; Maintainer for grep is bug-grep@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Oct 2019 16:08:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 03 12:08:54 2019
Received: from localhost ([127.0.0.1]:40882 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iG3ev-0006Dz-RR
	for submit <at> debbugs.gnu.org; Thu, 03 Oct 2019 12:08:54 -0400
Received: from lists.gnu.org ([209.51.188.17]:54127)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mahdiumd@HIDDEN>) id 1iG3R9-0005nC-Mu
 for submit <at> debbugs.gnu.org; Thu, 03 Oct 2019 11:54:39 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49117)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <mahdiumd@HIDDEN>) id 1iG3R8-0001cY-BU
 for bug-grep@HIDDEN; Thu, 03 Oct 2019 11:54:39 -0400
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,FREEMAIL_FROM,
 HTML_MESSAGE autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <mahdiumd@HIDDEN>) id 1iG3R7-000321-7N
 for bug-grep@HIDDEN; Thu, 03 Oct 2019 11:54:38 -0400
Received: from mail-vk1-xa42.google.com ([2607:f8b0:4864:20::a42]:43049)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <mahdiumd@HIDDEN>) id 1iG3R7-00031t-3E
 for bug-grep@HIDDEN; Thu, 03 Oct 2019 11:54:37 -0400
Received: by mail-vk1-xa42.google.com with SMTP id p189so737903vkf.10
 for <bug-grep@HIDDEN>; Thu, 03 Oct 2019 08:54:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to;
 bh=CopDsnQDOV0+AXzAMsvkCkWltOy0tZASiV0dgXZhiIM=;
 b=fs1CueSu927fQtD6PmaZSZD4Pu9f/jc26X5986eMYpDFTSirzEfqkgQXEmq7UD798q
 zK2hs6D6pRQ4xUXQSCh9V2dR2N7EK7nj7YswwXaA7yJ5QBe+HgsaH2FbbstpdFZnGlTW
 ehd6Yq5BwiT4PB4MTkHpNks4AiDmE/qUY6opRs44Vz4eobWF5Cs9dV6ECxBOMG0tHPlp
 c0QNXJuO30s1+0+k23GWT0Q9YobWsnhi6nfTu3w0ha7SO//OaZhOUC8/s8ocruRvS+K6
 2HvN6b6EYWvH58OG9wTt2tWx5JYLMGfOMGc5TWISa0uQNdBXS52aOaN/tXMOSV7yYEc3
 eeYw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=CopDsnQDOV0+AXzAMsvkCkWltOy0tZASiV0dgXZhiIM=;
 b=ufiihz3YkPf/YfUUAVjYHjd3J/mAMpxN/9a4jZLPsry1C1qYFs3FjaiJMUTyS3qOoU
 tDEyBwei6OPCQVMH8wo1/92bsRH/No4e3ubJY5FJX16KicyD8/+UHiEVqjY6PSgCl78O
 zIID0osEAD/XinB9Efc25Ug3SBjJ6S6hEe4D0CCundxXySg//xsjg1tZI//nH04Z1EOe
 Z6UuLE6bac6x3mPjn5sWu42/PKw4DFlpHMtnkFzF9WKdG7wYVVuNPQXvM7xlEdwvw81P
 SSYEBwwPqnC1lYKSG4wnSQcfLVJ0zGOoIt7QzpD1kv1/0sr0z8QW0LqeAIg/pimmU3wZ
 uQvA==
X-Gm-Message-State: APjAAAXRfhO+kt6YH1UhmRUK8zhmHZdzx8oLpYAsJX/3dy2geiWIUxDO
 Nm1CnvIr9BqBL/YttyanAHA+Xp3/miKVGWABgeRrMHcYwNs=
X-Google-Smtp-Source: APXvYqxHX/wHIWx6TSFx88J2IzUYYN17P3krSczPWS3T1zTO47m1K1k5Xb28AXdDsX06mYPqA4fWaWOx0z3+vXDhbrU=
X-Received: by 2002:a1f:2343:: with SMTP id j64mr5277093vkj.84.1570118076244; 
 Thu, 03 Oct 2019 08:54:36 -0700 (PDT)
MIME-Version: 1.0
From: Matt Zand <mahdiumd@HIDDEN>
Date: Thu, 3 Oct 2019 11:54:24 -0400
Message-ID: <CAJHWHyXX0R4rOKQ2XwNQ8xw+cH99_OKF=1ZUNq_MjUQVFWwZZQ@HIDDEN>
Subject: How to use Grep with Using -o
To: bug-grep@HIDDEN
Content-Type: multipart/alternative; boundary="00000000000030a9650594039a38"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2607:f8b0:4864:20::a42
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 03 Oct 2019 12:08:52 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--00000000000030a9650594039a38
Content-Type: text/plain; charset="UTF-8"

Hi,

Is it possible to output symbols which constitute non-matched parts of
text? For instance, I expect

printf "banana\napple" | grep --invert-match --only-matching 'ban'

to produce

ana
apple

or

apple

, but it doesn't produce anything.

I need -o because I grep multiline pattern with -z.




-- 
Cheers,

Matt Zand
Cell: 202-420-9192
Work: 240-200-6131
High School Technology Services <https://myhsts.org/>
DC Web Makers <https://dcwebmakers.com/>
Coding Bootcamps <https://coding-bootcamps.com/>

--00000000000030a9650594039a38
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">

<pre class=3D"gmail-message" style=3D"font-family:monospace;padding-top:0px=
;margin-top:0px;border-top:0px none;white-space:pre-wrap;color:rgb(0,0,0);f=
ont-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;fon=
t-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-tr=
ansform:none;word-spacing:0px;background-color:rgb(254,254,254);text-decora=
tion-style:initial;text-decoration-color:initial"><span style=3D"font-famil=
y:arial,sans-serif">Hi,

Is it possible to output symbols which constitute non-matched parts of text=
? For instance, I expect

printf &quot;banana\napple&quot; | grep --invert-match --only-matching &#39=
;ban&#39;

to produce

ana
apple

or

apple

, but it doesn&#39;t produce anything.

I need -o because I grep multiline pattern with -z.</span>
</pre><br class=3D"gmail-Apple-interchange-newline">

<br clear=3D"all"><br>-- <br><div dir=3D"ltr" class=3D"gmail_signature" dat=
a-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div=
><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div>Che=
ers,<br><br>Matt Zand<br></div><div>Cell: 202-420-9192<br>Work: 240-200-613=
1</div><div><a href=3D"https://myhsts.org/" target=3D"_blank">High School T=
echnology Services</a></div><div><a href=3D"https://dcwebmakers.com/" targe=
t=3D"_blank">DC Web Makers</a></div><div><a href=3D"https://coding-bootcamp=
s.com/" target=3D"_blank">Coding Bootcamps</a><br></div><div></div><br></di=
v></div></div></div></div></div></div></div></div></div></div></div>

--00000000000030a9650594039a38--




Acknowledgement sent to Matt Zand <mahdiumd@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-grep@HIDDEN. Full text available.
Report forwarded to bug-grep@HIDDEN:
bug#37607; Package grep. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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