X-Loop: help-debbugs@HIDDEN Subject: bug#21865: Parenthesis subexpressions Resent-From: Valerio Bozzolan <bozzolan.valerio@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Sun, 08 Nov 2015 21:58:02 +0000 Resent-Message-ID: <handler.21865.B.144701982627077 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 21865 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 21865 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-grep@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.144701982627077 (code B ref -1); Sun, 08 Nov 2015 21:58:02 +0000 Received: (at submit) by debbugs.gnu.org; 8 Nov 2015 21:57:06 +0000 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 From: Valerio Bozzolan <bozzolan.valerio@HIDDEN> Date: Sun, 08 Nov 2015 21:42:44 +0100 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-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've already asked this question to my local GNU/Linux user group and in #grep@HIDDEN I'm still confused.<br> <br> GNU Grep don't have an arg to choose the subexpression. Right?<br> <br> Stupid e.g.:<br> echo abcde | grep -o -E 'b([a-z])d'<br> => "bcd"<br> <br> What if I want the first subexpression? ("b")? GNU Grep can't do it. Isn'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--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Valerio Bozzolan <bozzolan.valerio@HIDDEN> Subject: bug#21865: Acknowledgement (Parenthesis subexpressions) Message-ID: <handler.21865.B.144701982627077.ack <at> debbugs.gnu.org> References: <A752B9CC-5AE8-4F51-94F2-E0E75F59BFCC@HIDDEN> X-Gnu-PR-Message: ack 21865 X-Gnu-PR-Package: grep Reply-To: 21865 <at> debbugs.gnu.org Date: Sun, 08 Nov 2015 21:58:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-grep@HIDDEN If you wish to submit further information on this problem, please send it to 21865 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 21865: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D21865 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN Subject: bug#21865: Parenthesis subexpressions Resent-From: Valerio Bozzolan <bozzolan.valerio@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Sun, 08 Nov 2015 22:36:02 +0000 Resent-Message-ID: <handler.21865.B.144702214030659 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 21865 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: 21865 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-grep@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.144702214030659 (code B ref -1); Sun, 08 Nov 2015 22:36:02 +0000 Received: (at submit) by debbugs.gnu.org; 8 Nov 2015 22:35:40 +0000 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 From: Valerio Bozzolan <bozzolan.valerio@HIDDEN> Date: Sun, 08 Nov 2015 21:49:03 +0100 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-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 'b([a-z])d'<br> => "bcd"<br> <br> Can't I choose to have only "c"?<br> <br> Thanks again!<br><br><div class="gmail_quote">On 8 November 2015 21:42:44 CET, Valerio Bozzolan <bozzolan.valerio@HIDDEN> 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've already asked this question to my local GNU/Linux user group and in #grep@HIDDEN I'm still confused.<br /> <br /> GNU Grep don't have an arg to choose the subexpression. Right?<br /> <br /> Stupid e.g.:<br /> echo abcde | grep -o -E 'b([a-z])d'<br /> => "bcd"<br /> <br /> What if I want the first subexpression? ("b")? GNU Grep can't do it. Isn'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--
X-Loop: help-debbugs@HIDDEN Subject: bug#21865: Parenthesis subexpressions Resent-From: Stephane Chazelas <stephane.chazelas@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 09 Nov 2015 13:52:01 +0000 Resent-Message-ID: <handler.21865.B21865.144707706929173 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 21865 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Valerio Bozzolan <bozzolan.valerio@HIDDEN> Cc: 21865 <at> debbugs.gnu.org Received: via spool by 21865-submit <at> debbugs.gnu.org id=B21865.144707706929173 (code B ref 21865); Mon, 09 Nov 2015 13:52:01 +0000 Received: (at 21865) by debbugs.gnu.org; 9 Nov 2015 13:51:09 +0000 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> 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-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
X-Loop: help-debbugs@HIDDEN Subject: bug#21865: Parenthesis subexpressions Resent-From: Valerio Bozzolan <bozzolan.valerio@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 09 Nov 2015 16:05:01 +0000 Resent-Message-ID: <handler.21865.B21865.14470850469858 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 21865 X-GNU-PR-Package: grep X-GNU-PR-Keywords: Cc: 21865 <at> debbugs.gnu.org Received: via spool by 21865-submit <at> debbugs.gnu.org id=B21865.14470850469858 (code B ref 21865); Mon, 09 Nov 2015 16:05:01 +0000 Received: (at 21865) by debbugs.gnu.org; 9 Nov 2015 16:04:06 +0000 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 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-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 "-o".<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 "egrep -o $n regex" 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 <stephane.chazelas@HIDDEN> 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 /> => "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--
X-Loop: help-debbugs@HIDDEN Subject: bug#21865: Parenthesis subexpressions Resent-From: Stephane Chazelas <stephane.chazelas@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-grep@HIDDEN Resent-Date: Mon, 09 Nov 2015 17:28:02 +0000 Resent-Message-ID: <handler.21865.B21865.144709002417365 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 21865 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Valerio Bozzolan <bozzolan.valerio@HIDDEN> Received: via spool by 21865-submit <at> debbugs.gnu.org id=B21865.144709002417365 (code B ref 21865); Mon, 09 Nov 2015 17:28:02 +0000 Received: (at 21865) by debbugs.gnu.org; 9 Nov 2015 17:27:04 +0000 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> 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-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
Received: (at control) by debbugs.gnu.org; 31 Dec 2015 08:55:23 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Dec 31 03:55:23 2015 Received: from localhost ([127.0.0.1]:50938 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1aEZ11-0005OJ-J5 for submit <at> debbugs.gnu.org; Thu, 31 Dec 2015 03:55:23 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41868) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <eggert@HIDDEN>) id 1aEZ0z-0005O1-Ht for control <at> debbugs.gnu.org; Thu, 31 Dec 2015 03:55:21 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 2C836160ED6 for <control <at> debbugs.gnu.org>; Thu, 31 Dec 2015 00:55:16 -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 Dsi6TvFEL1b3 for <control <at> debbugs.gnu.org>; Thu, 31 Dec 2015 00:55:15 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 4FFD0160ED7 for <control <at> debbugs.gnu.org>; Thu, 31 Dec 2015 00:55:15 -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 EnJ9ehm4awCT for <control <at> debbugs.gnu.org>; Thu, 31 Dec 2015 00:55:15 -0800 (PST) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 3587F160ED6 for <control <at> debbugs.gnu.org>; Thu, 31 Dec 2015 00:55:15 -0800 (PST) To: control <at> debbugs.gnu.org From: Paul Eggert <eggert@HIDDEN> Subject: grep bug maintenance Organization: UCLA Computer Science Department Message-ID: <5684ED73.6060403@HIDDEN> Date: Thu, 31 Dec 2015 00:55:15 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control 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: -0.0 (/) severity 22059 wishlist severity 21865 wishlist close 22278 close 22279 close 21755 close 21700 tags 21554 wontfix tags 21527 moreinfo
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.