GNU bug report logs - #21865
Parenthesis subexpressions

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; Severity: wishlist; Reported by: Valerio Bozzolan <bozzolan.valerio@HIDDEN>; dated Sun, 8 Nov 2015 21:58:02 UTC; Maintainer for grep is bug-grep@HIDDEN.
Severity set to 'wishlist' from 'normal' Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 21865) by debbugs.gnu.org; 9 Nov 2015 17:27:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 09 12:27:04 2015
Received: from localhost ([127.0.0.1]:59412 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZvqDg-0004W1-00
	for submit <at> debbugs.gnu.org; Mon, 09 Nov 2015 12:27:04 -0500
Received: from mail-wm0-f54.google.com ([74.125.82.54]:34420)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <stephane.chazelas@HIDDEN>) id 1ZvqDM-0004VK-3v
 for 21865 <at> debbugs.gnu.org; Mon, 09 Nov 2015 12:27:03 -0500
Received: by wmnn186 with SMTP id n186so116595187wmn.1
 for <21865 <at> debbugs.gnu.org>; Mon, 09 Nov 2015 09:26:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=resent-from:resent-date:resent-message-id:resent-to:date:from:to
 :subject:message-id:references:mime-version:content-type
 :content-disposition:in-reply-to:user-agent;
 bh=DQL65UHwea4FcWN69KFRfRLMi5HTbJNQjFWBqkfc6Tc=;
 b=zLj7/J+j893fkmZNnQeFMrMSKzAPSEkA3cR9XqlpRQp4IT2VHCGoFXhWk8cq+bU8B/
 3kzvMmFcfNjVSCw5hh03ESJXA4q17DeaVlrZaRJHQdiA12OYSwoucdf8T7Tb39vKbvGx
 eoEDb2zy45EADXGyIv/s0BSJORGbCcii7RX7AN3wL2eeGDRav4mHytfT2VoHAoeT3TEM
 Y+aggHL07GTCDCBpdYgOW61XWtOECBIkuK4HtBGj6VjXAKNCBfSDDDJsjqhzGH0Zc73Q
 MTtEa2ybv47G3y6FF106BPHYnr8uSesRs3lNoLZV+ydEnn7FdGU6ob3di3qtap/HQPtj
 zdCQ==
X-Received: by 10.194.7.97 with SMTP id i1mr35803364wja.87.1447090003219;
 Mon, 09 Nov 2015 09:26:43 -0800 (PST)
Received: from chaz.gmail.com (05421d95.skybroadband.com. [5.66.29.149])
 by smtp.gmail.com with ESMTPSA id 71sm15330750wmm.24.2015.11.09.09.26.42
 for <21865 <at> debbugs.gnu.org>
 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
 Mon, 09 Nov 2015 09:26:43 -0800 (PST)
Resent-From: Stephane Chazelas <stephane.chazelas@HIDDEN>
Resent-Date: Mon, 9 Nov 2015 17:26:42 +0000
Resent-Message-ID: <20151109172642.GA14624@HIDDEN>
Resent-To: 21865 <at> debbugs.gnu.org
Date: Mon, 9 Nov 2015 17:16:19 +0000
From: Stephane Chazelas <stephane.chazelas@HIDDEN>
To: Valerio Bozzolan <bozzolan.valerio@HIDDEN>
Subject: Re: bug#21865: Parenthesis subexpressions
Message-ID: <20151109171619.GA9658@HIDDEN>
References: <A752B9CC-5AE8-4F51-94F2-E0E75F59BFCC@HIDDEN>
 <26C5964E-1809-4066-B3B7-CBC4A1C081A9@HIDDEN>
 <20151109135045.GA9675@HIDDEN>
 <EE97D43F-46AF-4E37-B695-35A1EC2658AE@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <EE97D43F-46AF-4E37-B695-35A1EC2658AE@HIDDEN>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 21865
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
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: 0.0 (/)

2015-11-09 17:00:36 +0100, Valerio Bozzolan:
> Thanks for agreeing with the evolution of the meaning of "-o".
> 
> Just to make you a laugh: I was reproducing egrep with $BASH_REMATCH:
> https://gist.github.com/valerio-bozzolan/6787675e931dce1ba7e9
> 
> Definitely not beautiful... but really effective for me.

You may want to read:

https://unix.stackexchange.com/questions/169716/why-is-using-a-shell-loop-to-process-text-considered-bad-practice
https://unix.stackexchange.com/questions/209123/understand-ifs-read-r-line
https://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo

Here, if there wasn't a pcregrep already, I'd rather do it in
perl or GNU sed than bash.

Like:

perl -lne 'print for /a([a-z])c/g'

Also note that:

echo abac | pcregrep -o1 'a(.)'
b
c

> So something like "egrep -o $n regex" also can save the world from code similar to mine.

GNU grep can't add it like that as that would break backward
compatibility.

grep -o 1 regex file

is currently meant to print the occurrences of "1" in the
"regex" and "file" files.

Even adding it as:

grep -o1 regex file

would probably not be a good idea as that would mean some
ad-hoc parsing of the options (in "grep -o1 regexp", "1" would
be an argument to "-o" while in "grep -oi regexp", "i" currently
is a separate "-i" option).

So reasonably, it should probably be a separate option like -O 1.

-- 
Stephane




Information forwarded to bug-grep@HIDDEN:
bug#21865; Package grep. Full text available.

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


Received: (at 21865) by debbugs.gnu.org; 9 Nov 2015 16:04:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 09 11:04:06 2015
Received: from localhost ([127.0.0.1]:59381 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZvovO-0002Yw-0E
	for submit <at> debbugs.gnu.org; Mon, 09 Nov 2015 11:04:06 -0500
Received: from bagheera.educ.di.unito.it ([130.192.157.8]:48676)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvovL-0002YV-7t
 for 21865 <at> debbugs.gnu.org; Mon, 09 Nov 2015 11:04:04 -0500
Received: from service.labinfo.educ.di.unito.it (service [130.192.157.3])
 by bagheera.educ.di.unito.it (FRW-EDUC-INFODIP) with ESMTP id tA9G3m72019378
 for <21865 <at> debbugs.gnu.org>; Mon, 9 Nov 2015 17:03:48 +0100 (CET)
Received: from android-12971102cb783e32
 (host126-88-dynamic.244-95-r.retail.telecomitalia.it [95.244.88.126])
 (authenticated bits=0)
 by service.labinfo.educ.di.unito.it (8.14.4/8.14.4) with ESMTP id
 tA9G3hQR001086
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
 for <21865 <at> debbugs.gnu.org>; Mon, 9 Nov 2015 17:03:44 +0100 (CET)
User-Agent: K-9 Mail for Android
In-Reply-To: <20151109135045.GA9675@HIDDEN>
References: <A752B9CC-5AE8-4F51-94F2-E0E75F59BFCC@HIDDEN>
 <26C5964E-1809-4066-B3B7-CBC4A1C081A9@HIDDEN>
 <20151109135045.GA9675@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="----V1N35ZTS6BAUF5FX59QO5T3ANXJ7IU"
Content-Transfer-Encoding: 8bit
Subject: Re: bug#21865: Parenthesis subexpressions
From: Valerio Bozzolan <bozzolan.valerio@HIDDEN>
Date: Mon, 09 Nov 2015 17:03:39 +0100
Message-ID: <C2E59BDC-0D71-4785-A303-6879EF83AB4B@HIDDEN>
X-AntiVirus: Scanned for viruses by VirusFinder @2001-tecnici@HIDDEN
 - Email Clean
X-SpamCheck: not spam
X-MailScanner-From: bozzolan.valerio@HIDDEN
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: 21865
Cc: 21865 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
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: 0.9 (/)

------V1N35ZTS6BAUF5FX59QO5T3ANXJ7IU
Content-Transfer-Encoding: 8bit
Content-Type: text/plain;
 charset=UTF-8

Thanks for agreeing with the evolution of the meaning of "-o".

Just to make you a laugh: I was reproducing egrep with $BASH_REMATCH:
https://gist.github.com/valerio-bozzolan/6787675e931dce1ba7e9

Definitely not beautiful... but really effective for me.

So something like "egrep -o $n regex" also can save the world from code similar to mine.

On 9 November 2015 14:50:46 CET, Stephane Chazelas <stephane.chazelas@HIDDEN> wrote:
>2015-11-08 21:49:03 +0100, Valerio Bozzolan:
>> Sorry... typo...
>> 
>>     echo abcde | grep -o -E 'b([a-z])d'
>>     => "bcd"
>> 
>> Can't I choose to have only "c"?
>[...]
>
>That's correct, GNU grep doesn't have that capability (yet).
>Recent versions of pcregrep do:
>
>$ echo abc | pcregrep -o1 '.(.).'
>b
>
>Now, I'm not a GNU grep maintainer but I suppose the question is
>how far do we want to take grep away from its original purpose
>(print the lines that match a pattern which is what g/re/p
>stands for).
>
>GNU grep is already doing find's job with -r, part of sed's job
>with -o/--colour.
>
>Having said that, I do agree it's the logical continuation after
>-o.
>
>Note that for now, you can already do:
>
>$ echo abcde | grep -o -P 'b\K[a-z](?=d)'
>c
>
>
>-- 
>Stephane

-- 
Valerio Bozzolan
Email sent from Android (CyanogenMod) using K-9 Mail.
------V1N35ZTS6BAUF5FX59QO5T3ANXJ7IU
Content-Type: text/html;
 charset=utf-8
Content-Transfer-Encoding: 8bit

<html><head></head><body>Thanks for agreeing with the evolution of the meaning of &quot;-o&quot;.<br>
<br>
Just to make you a laugh: I was reproducing egrep with $BASH_REMATCH:<br>
<a href="https://gist.github.com/valerio-bozzolan/6787675e931dce1ba7e9">https://gist.github.com/valerio-bozzolan/6787675e931dce1ba7e9</a><br>
<br>
Definitely not beautiful... but really effective for me.<br>
<br>
So something like &quot;egrep -o $n regex&quot; also can save the world from code similar to mine.<br><br><div class="gmail_quote">On 9 November 2015 14:50:46 CET, Stephane Chazelas &lt;stephane.chazelas@HIDDEN&gt; wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">2015-11-08 21:49:03 +0100, Valerio Bozzolan:<br /><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> Sorry... typo...<br /> <br />     echo abcde | grep -o -E 'b([a-z])d'<br />     =&gt; "bcd"<br /> <br /> Can't I choose to have only "c"?<br /></blockquote>[...]<br /><br />That's correct, GNU grep doesn't have that capability (yet).<br />Recent versions of pcregrep do:<br /><br />$ echo abc | pcregrep -o1 '.(.).'<br />b<br /><br />Now, I'm not a GNU grep maintainer but I suppose the question is<br />how far do we want to take grep away from its original purpose<br />(print the lines that match a pattern which is what g/re/p<br />stands for).<br /><br />GNU grep is already doing find's job with -r, part of sed's job<br />with -o/--colour.<br /><br />Having said that, I do agree it's the logical continuation after<br />-o.<br /><br />Note that for now, you can already do:<br /><br />$ echo!
  abcde |
grep -o -P 'b\K[a-z](?=d)'<br />c<br /><br /></pre></blockquote></div><br>
-- <br>
Valerio Bozzolan<br>
Email sent from Android (CyanogenMod) using K-9 Mail.</body></html>
------V1N35ZTS6BAUF5FX59QO5T3ANXJ7IU--





Information forwarded to bug-grep@HIDDEN:
bug#21865; Package grep. Full text available.

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


Received: (at 21865) by debbugs.gnu.org; 9 Nov 2015 13:51:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Nov 09 08:51:09 2015
Received: from localhost ([127.0.0.1]:58325 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Zvmqi-0007aT-Pc
	for submit <at> debbugs.gnu.org; Mon, 09 Nov 2015 08:51:09 -0500
Received: from mail-wm0-f50.google.com ([74.125.82.50]:35779)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <stephane.chazelas@HIDDEN>) id 1ZvmqO-0007Zk-Nn
 for 21865 <at> debbugs.gnu.org; Mon, 09 Nov 2015 08:51:07 -0500
Received: by wmdw130 with SMTP id w130so30261890wmd.0
 for <21865 <at> debbugs.gnu.org>; Mon, 09 Nov 2015 05:50:47 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=date:from:to:cc:subject:message-id:references:mime-version
 :content-type:content-disposition:content-transfer-encoding
 :in-reply-to:user-agent;
 bh=JW9TXqfAh1CanYNfPUrid5w3AA1DML5YlCB/ZGWjkZ0=;
 b=aj4C/dfDXv9rQeFKaulo0lAbJuA0RR4S10zjHPR8M27xlQKJXHF/mvOQlwLxez275r
 P/h+tCqSXT31fr9y2hv5pJTNR+Gq7PWwcT4KUwOufjfpboLy3C//VgvRXEnYUvPJVews
 CwIkk/nV6ZpPdQ9ZBeqfRRQBhfXRjSL/1KLntGJhVzj01vtVuVrgmK33jjurYV+eUKKa
 fWZOJ23mRBWa4538hoVHERzQEJzJK2U6aEbq2T4x7sHNdaC7F2IrCxZK0VucFaeRszAz
 fz10nk8IX7ImZMb/Q6l6jMCTqxQfQJorzpZ/ylnNUb2cJdL7bNkeAg5o/+iyhLhMKr3S
 FzKA==
X-Received: by 10.28.47.8 with SMTP id v8mr10525384wmv.30.1447077047774;
 Mon, 09 Nov 2015 05:50:47 -0800 (PST)
Received: from chaz.gmail.com (05421d95.skybroadband.com. [5.66.29.149])
 by smtp.gmail.com with ESMTPSA id s2sm14431637wmd.13.2015.11.09.05.50.46
 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
 Mon, 09 Nov 2015 05:50:46 -0800 (PST)
Date: Mon, 9 Nov 2015 13:50:46 +0000
From: Stephane Chazelas <stephane.chazelas@HIDDEN>
To: Valerio Bozzolan <bozzolan.valerio@HIDDEN>
Subject: Re: bug#21865: Parenthesis subexpressions
Message-ID: <20151109135045.GA9675@HIDDEN>
References: <A752B9CC-5AE8-4F51-94F2-E0E75F59BFCC@HIDDEN>
 <26C5964E-1809-4066-B3B7-CBC4A1C081A9@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <26C5964E-1809-4066-B3B7-CBC4A1C081A9@HIDDEN>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 21865
Cc: 21865 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
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: 0.0 (/)

2015-11-08 21:49:03 +0100, Valerio Bozzolan:
> Sorry... typo...
> 
>     echo abcde | grep -o -E 'b([a-z])d'
>     => "bcd"
> 
> Can't I choose to have only "c"?
[...]

That's correct, GNU grep doesn't have that capability (yet).
Recent versions of pcregrep do:

$ echo abc | pcregrep -o1 '.(.).'
b

Now, I'm not a GNU grep maintainer but I suppose the question is
how far do we want to take grep away from its original purpose
(print the lines that match a pattern which is what g/re/p
stands for).

GNU grep is already doing find's job with -r, part of sed's job
with -o/--colour.

Having said that, I do agree it's the logical continuation after
-o.

Note that for now, you can already do:

$ echo abcde | grep -o -P 'b\K[a-z](?=d)'
c


-- 
Stephane




Information forwarded to bug-grep@HIDDEN:
bug#21865; Package grep. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 8 Nov 2015 22:35:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 08 17:35:40 2015
Received: from localhost ([127.0.0.1]:57921 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZvYYT-0007y4-AS
	for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 17:35:40 -0500
Received: from eggs.gnu.org ([208.118.235.92]:57372)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC9-0005uV-UQ
 for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 16:08:33 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC9-0000hX-18
 for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 16:08:13 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: ***
X-Spam-Status: No, score=3.3 required=5.0 tests=BAYES_50,HTML_MESSAGE,
 RECEIVED_FROM_WINDOWS_HOST autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:44005)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC8-0000hT-UP
 for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 16:08:12 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39134)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC7-00018y-RF
 for bug-grep@HIDDEN; Sun, 08 Nov 2015 16:08:12 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC5-0000eC-4U
 for bug-grep@HIDDEN; Sun, 08 Nov 2015 16:08:11 -0500
Received: from bagheera.educ.di.unito.it ([130.192.157.8]:38407)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC4-0000dW-OL
 for bug-grep@HIDDEN; Sun, 08 Nov 2015 16:08:09 -0500
Received: from service.labinfo.educ.di.unito.it (service [130.192.157.3])
 by bagheera.educ.di.unito.it (FRW-EDUC-INFODIP) with ESMTP id tA8KnqPq010302
 for <bug-grep@HIDDEN>; Sun, 8 Nov 2015 21:49:52 +0100 (CET)
Received: from android-12971102cb783e32
 (host197-171-dynamic.233-95-r.retail.telecomitalia.it [95.233.171.197] (may
 be forged)) (authenticated bits=0)
 by service.labinfo.educ.di.unito.it (8.14.4/8.14.4) with ESMTP id
 tA8Knl61029917
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
 for <bug-grep@HIDDEN>; Sun, 8 Nov 2015 21:49:49 +0100 (CET)
User-Agent: K-9 Mail for Android
In-Reply-To: <A752B9CC-5AE8-4F51-94F2-E0E75F59BFCC@HIDDEN>
References: <A752B9CC-5AE8-4F51-94F2-E0E75F59BFCC@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="----20WOICGV4HQVLHDL12S12HCQDMPG8T"
Content-Transfer-Encoding: 8bit
Subject: Re: Parenthesis subexpressions
From: Valerio Bozzolan <bozzolan.valerio@HIDDEN>
Date: Sun, 08 Nov 2015 21:49:03 +0100
To: bug-grep@HIDDEN
Message-ID: <26C5964E-1809-4066-B3B7-CBC4A1C081A9@HIDDEN>
X-AntiVirus: Scanned for viruses by VirusFinder @2001-tecnici@HIDDEN
 - Email Clean
X-SpamCheck: not spam
X-MailScanner-From: bozzolan.valerio@HIDDEN
X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 08 Nov 2015 17:35:19 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
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: -4.1 (----)

------20WOICGV4HQVLHDL12S12HCQDMPG8T
Content-Transfer-Encoding: 8bit
Content-Type: text/plain;
 charset=UTF-8

Sorry... typo...

    echo abcde | grep -o -E 'b([a-z])d'
    => "bcd"

Can't I choose to have only "c"?

Thanks again!

On 8 November 2015 21:42:44 CET, Valerio Bozzolan <bozzolan.valerio@HIDDEN> wrote:
>Hi,
>
>(First time in a GNU mailing list!)
>
>I've already asked this question to my local GNU/Linux user group and
>in #grep@HIDDEN I'm still confused.
>
>GNU Grep don't have an arg to choose the subexpression. Right?
>
>Stupid e.g.:
>    echo abcde | grep -o -E 'b([a-z])d'
>    => "bcd"
>
>What if I want the first subexpression? ("b")? GNU Grep can't do it.
>Isn't it? (Why?)
>
>I actually use GNU Awk, or GNU Bash with $BASH_REMATCH[$n_sub].
>
>Thank you for the clarification!
>--
>Valerio Bozzolan
>Email sent from Android (CyanogenMod) using K-9 Mail.

-- 
Valerio Bozzolan
Email sent from Android (CyanogenMod) using K-9 Mail.

http://boz.reyboz.it
------20WOICGV4HQVLHDL12S12HCQDMPG8T
Content-Type: text/html;
 charset=utf-8
Content-Transfer-Encoding: 8bit

<html><head></head><body>Sorry... typo...<br>
<br>
    echo abcde | grep -o -E &#39;b([a-z])d&#39;<br>
    =&gt; &quot;bcd&quot;<br>
<br>
Can&#39;t I choose to have only &quot;c&quot;?<br>
<br>
Thanks again!<br><br><div class="gmail_quote">On 8 November 2015 21:42:44 CET, Valerio Bozzolan &lt;bozzolan.valerio@HIDDEN&gt; wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br />
<br />
(First time in a GNU mailing list!)<br />
<br />
I&#39;ve already asked this question to my local GNU/Linux user group and in #grep@HIDDEN I&#39;m still confused.<br />
<br />
GNU Grep don&#39;t have an arg to choose the subexpression. Right?<br />
<br />
Stupid e.g.:<br />
    echo abcde | grep -o -E &#39;b([a-z])d&#39;<br />
    =&gt; &quot;bcd&quot;<br />
<br />
What if I want the first subexpression? (&quot;b&quot;)? GNU Grep can&#39;t do it. Isn&#39;t it? (Why?)<br />
<br />
I actually use GNU Awk, or GNU Bash with $BASH_REMATCH[$n_sub].<br />
<br />
Thank you for the clarification!<br />
--<br />
Valerio Bozzolan<br />
Email sent from Android (CyanogenMod) using K-9 Mail.</blockquote></div><br>
-- <br>
Valerio Bozzolan<br>
Email sent from Android (CyanogenMod) using K-9 Mail.<br>
<br>
<a href="http://boz.reyboz.it">http://boz.reyboz.it</a></body></html>
------20WOICGV4HQVLHDL12S12HCQDMPG8T--





Information forwarded to bug-grep@HIDDEN:
bug#21865; Package grep. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 8 Nov 2015 21:57:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 08 16:57:06 2015
Received: from localhost ([127.0.0.1]:57896 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ZvXxR-00072d-Aq
	for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 16:57:05 -0500
Received: from eggs.gnu.org ([208.118.235.92]:57371)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC9-0005uT-TZ
 for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 16:08:33 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC8-0000hP-QU
 for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 16:08:13 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: ***
X-Spam-Status: No, score=3.3 required=5.0 tests=BAYES_50,HTML_MESSAGE,
 RECEIVED_FROM_WINDOWS_HOST autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:59822)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC8-0000hE-NU
 for submit <at> debbugs.gnu.org; Sun, 08 Nov 2015 16:08:12 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39133)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC7-00018x-R6
 for bug-grep@HIDDEN; Sun, 08 Nov 2015 16:08:12 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC4-0000dv-Ay
 for bug-grep@HIDDEN; Sun, 08 Nov 2015 16:08:11 -0500
Received: from bagheera.educ.di.unito.it ([130.192.157.8]:38407)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <bozzolan.valerio@HIDDEN>)
 id 1ZvXC3-0000dW-WD
 for bug-grep@HIDDEN; Sun, 08 Nov 2015 16:08:08 -0500
Received: from service.labinfo.educ.di.unito.it (service [130.192.157.3])
 by bagheera.educ.di.unito.it (FRW-EDUC-INFODIP) with ESMTP id tA8KhW3Z010266
 for <bug-grep@HIDDEN>; Sun, 8 Nov 2015 21:43:33 +0100 (CET)
Received: from android-12971102cb783e32
 (host197-171-dynamic.233-95-r.retail.telecomitalia.it [95.233.171.197] (may
 be forged)) (authenticated bits=0)
 by service.labinfo.educ.di.unito.it (8.14.4/8.14.4) with ESMTP id
 tA8KhSBV029586
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
 for <bug-grep@HIDDEN>; Sun, 8 Nov 2015 21:43:29 +0100 (CET)
User-Agent: K-9 Mail for Android
MIME-Version: 1.0
Content-Type: multipart/alternative;
 boundary="----NX6JLVEXP41ZA2PIJXJH49U54QQYBR"
Content-Transfer-Encoding: 8bit
Subject: Parenthesis subexpressions
From: Valerio Bozzolan <bozzolan.valerio@HIDDEN>
Date: Sun, 08 Nov 2015 21:42:44 +0100
To: bug-grep@HIDDEN
Message-ID: <A752B9CC-5AE8-4F51-94F2-E0E75F59BFCC@HIDDEN>
X-AntiVirus: Scanned for viruses by VirusFinder @2001-tecnici@HIDDEN
 - Email Clean
X-SpamCheck: not spam
X-MailScanner-From: bozzolan.valerio@HIDDEN
X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 08 Nov 2015 16:57:03 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
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: -4.1 (----)

------NX6JLVEXP41ZA2PIJXJH49U54QQYBR
Content-Transfer-Encoding: 8bit
Content-Type: text/plain;
 charset=UTF-8

Hi,

(First time in a GNU mailing list!)

I've already asked this question to my local GNU/Linux user group and in #grep@HIDDEN I'm still confused.

GNU Grep don't have an arg to choose the subexpression. Right?

Stupid e.g.:
    echo abcde | grep -o -E 'b([a-z])d'
    => "bcd"

What if I want the first subexpression? ("b")? GNU Grep can't do it. Isn't it? (Why?)

I actually use GNU Awk, or GNU Bash with $BASH_REMATCH[$n_sub].

Thank you for the clarification!
--
Valerio Bozzolan
Email sent from Android (CyanogenMod) using K-9 Mail.
------NX6JLVEXP41ZA2PIJXJH49U54QQYBR
Content-Type: text/html;
 charset=utf-8
Content-Transfer-Encoding: 8bit

Hi,<br>
<br>
(First time in a GNU mailing list!)<br>
<br>
I&#39;ve already asked this question to my local GNU/Linux user group and in #grep@HIDDEN I&#39;m still confused.<br>
<br>
GNU Grep don&#39;t have an arg to choose the subexpression. Right?<br>
<br>
Stupid e.g.:<br>
    echo abcde | grep -o -E &#39;b([a-z])d&#39;<br>
    =&gt; &quot;bcd&quot;<br>
<br>
What if I want the first subexpression? (&quot;b&quot;)? GNU Grep can&#39;t do it. Isn&#39;t it? (Why?)<br>
<br>
I actually use GNU Awk, or GNU Bash with $BASH_REMATCH[$n_sub].<br>
<br>
Thank you for the clarification!<br>
--<br>
Valerio Bozzolan<br>
Email sent from Android (CyanogenMod) using K-9 Mail.
------NX6JLVEXP41ZA2PIJXJH49U54QQYBR--





Acknowledgement sent to Valerio Bozzolan <bozzolan.valerio@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-grep@HIDDEN. Full text available.
Report forwarded to bug-grep@HIDDEN:
bug#21865; 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.