From unknown Fri Jun 13 11:22:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#37607: How to use Grep with Using -o Resent-From: Matt Zand Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Thu, 03 Oct 2019 16:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37607 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 37607@debbugs.gnu.org X-Debbugs-Original-To: bug-grep@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.157011893523937 (code B ref -1); Thu, 03 Oct 2019 16:09:01 +0000 Received: (at submit) by debbugs.gnu.org; 3 Oct 2019 16:08:55 +0000 Received: from localhost ([127.0.0.1]:40882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iG3ev-0006Dz-RR for submit@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 ) id 1iG3R9-0005nC-Mu for submit@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 ) id 1iG3R8-0001cY-BU for bug-grep@gnu.org; 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 ) id 1iG3R7-000321-7N for bug-grep@gnu.org; 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 ) id 1iG3R7-00031t-3E for bug-grep@gnu.org; Thu, 03 Oct 2019 11:54:37 -0400 Received: by mail-vk1-xa42.google.com with SMTP id p189so737903vkf.10 for ; 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 Date: Thu, 3 Oct 2019 11:54:24 -0400 Message-ID: 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-Mailman-Approved-At: Thu, 03 Oct 2019 12:08:52 -0400 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: -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 DC Web Makers Coding Bootcamps --00000000000030a9650594039a38 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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.



--
Che= ers,

Matt Zand
Cell: 202-420-9192
Work: 240-200-613= 1

--00000000000030a9650594039a38-- From unknown Fri Jun 13 11:22:27 2025 X-Loop: help-debbugs@gnu.org Subject: bug#37607: How to use Grep with Using -o Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Thu, 02 Jan 2020 10:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37607 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Matt Zand , 37607@debbugs.gnu.org Received: via spool by 37607-submit@debbugs.gnu.org id=B37607.157795925016377 (code B ref 37607); Thu, 02 Jan 2020 10:01:01 +0000 Received: (at 37607) by debbugs.gnu.org; 2 Jan 2020 10:00:50 +0000 Received: from localhost ([127.0.0.1]:38251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imxHd-0004Fz-PG for submit@debbugs.gnu.org; Thu, 02 Jan 2020 05:00:50 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:49996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imxHc-0004Fn-Co for 37607@debbugs.gnu.org; Thu, 02 Jan 2020 05:00:48 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id F00DF160054; Thu, 2 Jan 2020 02:00:42 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id IC_rEdsnPb5A; Thu, 2 Jan 2020 02:00:42 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3875B160058; Thu, 2 Jan 2020 02:00:42 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id WYLawMKSowq4; Thu, 2 Jan 2020 02:00:42 -0800 (PST) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 1096B160054; Thu, 2 Jan 2020 02:00:42 -0800 (PST) References: From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <75f979cb-992d-5bfc-8803-10d5507541ab@cs.ucla.edu> Date: Thu, 2 Jan 2020 02:00:41 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) 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: -3.3 (---) On 10/3/19 8:54 AM, Matt Zand wrote: > 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. Unfortunately the -v and -o options don't currently combine in that way. Perhaps they should, or perhaps another option could be added to do what you want. I'll mark this as a wishlist item. From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 02 05:00:51 2020 Received: (at control) by debbugs.gnu.org; 2 Jan 2020 10:00:51 +0000 Received: from localhost ([127.0.0.1]:38254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imxHf-0004GD-LM for submit@debbugs.gnu.org; Thu, 02 Jan 2020 05:00:51 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:50016) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imxHe-0004Fp-6f for control@debbugs.gnu.org; Thu, 02 Jan 2020 05:00:50 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id C682F160058 for ; Thu, 2 Jan 2020 02:00:44 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 1mOhniLG3Dp4 for ; Thu, 2 Jan 2020 02:00:44 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 38990160071 for ; Thu, 2 Jan 2020 02:00:44 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id fOUsmVXznl-r for ; Thu, 2 Jan 2020 02:00:44 -0800 (PST) Received: from [192.168.1.9] (cpe-23-242-74-103.socal.res.rr.com [23.242.74.103]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 198A1160058 for ; Thu, 2 Jan 2020 02:00:44 -0800 (PST) To: control@debbugs.gnu.org From: Paul Eggert Subject: 37607 is wishlist Organization: UCLA Computer Science Department Message-ID: <4aa9da7f-27c2-806e-8818-a1cc893364d8@cs.ucla.edu> Date: Thu, 2 Jan 2020 02:00:43 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control 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: -3.3 (---) severity 37607 wishlist