From unknown Wed Jun 18 23:03:22 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#31705 <31705@debbugs.gnu.org> To: bug#31705 <31705@debbugs.gnu.org> Subject: Status: five grep / egrep issues Reply-To: bug#31705 <31705@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:03:22 +0000 retitle 31705 five grep / egrep issues reassign 31705 grep submitter 31705 Phillip Feldman severity 31705 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 04 03:23:36 2018 Received: (at submit) by debbugs.gnu.org; 4 Jun 2018 07:23:36 +0000 Received: from localhost ([127.0.0.1]:60810 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPjq4-0005Vs-C1 for submit@debbugs.gnu.org; Mon, 04 Jun 2018 03:23:36 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47249) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPgU5-0000Qa-8c for submit@debbugs.gnu.org; Sun, 03 Jun 2018 23:48:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPgTz-0000Z1-Ao for submit@debbugs.gnu.org; Sun, 03 Jun 2018 23:48:36 -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,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51240) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fPgTz-0000Yv-6a for submit@debbugs.gnu.org; Sun, 03 Jun 2018 23:48:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38220) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fPgTy-0005bx-0s for bug-grep@gnu.org; Sun, 03 Jun 2018 23:48:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fPgTx-0000Yb-5n for bug-grep@gnu.org; Sun, 03 Jun 2018 23:48:34 -0400 Received: from mail-ot0-x236.google.com ([2607:f8b0:4003:c0f::236]:40871) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fPgTx-0000YR-0M for bug-grep@gnu.org; Sun, 03 Jun 2018 23:48:33 -0400 Received: by mail-ot0-x236.google.com with SMTP id n1-v6so35886231otf.7 for ; Sun, 03 Jun 2018 20:48:32 -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=fAc0TrvriPzQNbJT7YJvV9kgafcS0qXKweFoGkGk57c=; b=ZhrCunSazY73GQlIr0dRSgZIJEep9vzUsY3P81WwKFFdzWA0Tbzp1i3uzBRFjQoI6+ m1czVd6RHa6gOAZh/jq3hlDjPAOFaJ4oEoltQsbHAuyuLLyfbHfh7w/AZascXfIS9FZD BMwbRCVEojSE+FN3HCfO2ei8eI8q8B1orodKP+nAC4KTR+RTLAFQfCiHHOshSZdJr7in +jKZCzzCokO7TttpWOji7yDQQ5jjKTJCVd1J0zp1/YYOL68Ow2NtZgn3u1BTWBTUJkoQ Hl8qZlk11nzHmAPYghOGqNNshzYq4E4XnkWIkdDXPU3YMpu+LIv8IKhyz55KoRzS7fuZ /qyQ== 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=fAc0TrvriPzQNbJT7YJvV9kgafcS0qXKweFoGkGk57c=; b=Ty8BGKXOFYiGX17wD22maOVOeVEWGzexbBcm+K6hlVRGkvHJdT+glTcQFxm3OfRGi4 X1z8XFDwK9uYKrdJNX+7uJGxjml+h+lx5z97Mqc+1JKFD5bLvXLZUfrVFCKOdwgodxNu kSKtq9z5rSUln8wgoX4vN6VUDJc7R0hk016FLGikVFudY/k8PvHbZnEty49rBOF/Xrv0 c55libl+CnFcz7eBRY5o74YhUsMuIzjYrTeDengKqKXgUNMGAurRs9IcpvEMmVatMP3I qhmXWtDuT+fq2hUVCd1FXjJHMAUPfZNsbUBYVPgJH18XzUIcEnfB7LQBba91g/aCf2k/ +tDg== X-Gm-Message-State: ALKqPwdNEivDLR5acmEBmXwwcjl6A0gX8IIOgF5nRDx2scyenqC4Ny5Y oUA0/7Llj5SQW0mi9er+3vEBlrm5eaORSO9kmsoHqw== X-Google-Smtp-Source: ADUXVKLjXfSRSFW1Ef+wlEp2GEbMzSlPbyBliJdcfcCQWTq0qhuw343FrBhjx4GPZx1OQ0MZ7Twh9SgYqBuie+vzft8= X-Received: by 2002:a9d:1531:: with SMTP id u46-v6mr14483609otf.197.1528084112015; Sun, 03 Jun 2018 20:48:32 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:2446:0:0:0:0:0 with HTTP; Sun, 3 Jun 2018 20:48:31 -0700 (PDT) From: Phillip Feldman Date: Sun, 3 Jun 2018 20:48:31 -0700 Message-ID: Subject: five grep / egrep issues To: bug-grep@gnu.org Content-Type: multipart/alternative; boundary="000000000000af06d7056dc8ce7e" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. 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.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 04 Jun 2018 03:23:35 -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: -5.0 (-----) --000000000000af06d7056dc8ce7e Content-Type: text/plain; charset="UTF-8" I would like to report the following unrelated issues: (1) `grep --help` and `egrep --help` should report the version number. (2) `egrep [abc]+ *.txt` works as expected, but if I try to do `egrep ^[abc]+ *.txt`, which anchors the pattern to the start of the line, I get no results, even though there are lines that match the pattern. (3) Specifying a pattern for FILE seems to work just fine unless one does a recursive search. (4) If one attempts to do a recursive search and omits the starting directory, it would be helpful if the default were the current working directory. An alternative would be to generate a warning or error message. Simply failing to produce any results is a bad design. (5) If one provides an invalid regex, e.g., something like '*xyz' (a regex can't begin with '*'), one should get a fatal error (grep and egrep accept such a regex without complaint, and simply return no results). Phillip M. Feldman --000000000000af06d7056dc8ce7e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I would like to report the following unrelated issues= :

(1) `grep --help` and `egrep --help` should repo= rt the version number.

(2) `egrep [abc]+ *.txt` wo= rks as expected, but if I try to do `egrep ^[abc]+ *.txt`, which anchors th= e pattern to the start of the line, I get no results,
even though= there are lines that match the pattern.

(3) Speci= fying a pattern for FILE seems to work just fine unless one does a recursiv= e search.

(4) If one attempts to do a recursive se= arch and omits the starting directory, it would be helpful if the default w= ere the current working directory. An
alternative would be to gen= erate a warning or error message. Simply failing to produce any results is = a bad design.

(5) If one provides an invalid regex= , e.g., something like '*xyz' (a regex can't begin with '*&= #39;), one should get a fatal error (grep and egrep accept such a
regex without complaint, and simply return no results).

Phillip M. Feldman
--000000000000af06d7056dc8ce7e-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 04 03:36:57 2018 Received: (at 31705) by debbugs.gnu.org; 4 Jun 2018 07:36:57 +0000 Received: from localhost ([127.0.0.1]:60821 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPk2z-0005ql-Kk for submit@debbugs.gnu.org; Mon, 04 Jun 2018 03:36:57 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:56056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fPk2y-0005qY-42 for 31705@debbugs.gnu.org; Mon, 04 Jun 2018 03:36:56 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 10AF816060F; Mon, 4 Jun 2018 00:36:50 -0700 (PDT) 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 fdE4IYgjkMtj; Mon, 4 Jun 2018 00:36:49 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 367AC160610; Mon, 4 Jun 2018 00:36:49 -0700 (PDT) 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 t-UjFfeEpQNG; Mon, 4 Jun 2018 00:36:49 -0700 (PDT) Received: from [192.168.1.9] (unknown [47.154.30.119]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id E636B16060F; Mon, 4 Jun 2018 00:36:48 -0700 (PDT) Subject: Re: bug#31705: five grep / egrep issues To: Phillip Feldman , 31705@debbugs.gnu.org References: From: Paul Eggert Openpgp: preference=signencrypt Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= xsFNBEyAcmQBEADAAyH2xoTu7ppG5D3a8FMZEon74dCvc4+q1XA2J2tBy2pwaTqfhpxxdGA9 Jj50UJ3PD4bSUEgN8tLZ0san47l5XTAFLi2456ciSl5m8sKaHlGdt9XmAAtmXqeZVIYX/UFS 96fDzf4xhEmm/y7LbYEPQdUdxu47xA5KhTYp5bltF3WYDz1Ygd7gx07Auwp7iw7eNvnoDTAl KAl8KYDZzbDNCQGEbpY3efZIvPdeI+FWQN4W+kghy+P6au6PrIIhYraeua7XDdb2LS1en3Ss mE3QjqfRqI/A2ue8JM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Q0KO FxHXXYHmRrS1OZPU59BLvc+TRhIhafSHKLwbXK+6ckkxBx6h8z5ccpG0Qs4bFhdFYnFrEieD LoGmnE2YLhdV6swJ9VNCS6pLiEohT3fm7aXm15tZOIyzMZhHRSAPblXxQ0ZSWjq8oRrcYNFx c4W1URpAkBCOYJoXvQfD5L3lqAl8TCqDUzYxhH/tJhbDdHrqHH767jaDaTB1+Talp/2AMKwc XNOdiklGxbmHVG6YGl6g8Lrbsu9NZEI4yLlHzuikthJWgz+3vZhVGyNlt+HNIoF6CjDL2omu 5cEq4RDHM44QqPk6l7O0pUvN1mT4B+S1b08RKpqm/ff015E37HNV/piIvJlxGAYz8PSfuGCB 1thMYqlmgdhd9/BabGFbGGYHA6U4/T5zqU+f6xHy1SsAQZ1MSKlLwekBIT+4/cLRGqCHjnV0 q5H/T6a7t5mPkbzSrOLSo4puj+IToNjYyYIDBWzhlA19avOa+rvUjmHtD3sFN7cXWtkGoi8b uNcby4U= Organization: UCLA Computer Science Department Message-ID: Date: Mon, 4 Jun 2018 00:36:48 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 31705 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 (---) Phillip Feldman wrote: > I would like to report the following unrelated issues: >=20 > (1) `grep --help` and `egrep --help` should report the version number. 'grep --version' should do what you want. That behavior is specified in t= he GNU=20 coding standards. > (2) `egrep [abc]+ *.txt` works as expected, but if I try to do `egrep > ^[abc]+ *.txt`, which anchors the pattern to the start of the line, I g= et > no results, > even though there are lines that match the pattern. The command works for me. For example: $ echo 'apple' | egrep ^[abc]+ apple If it doesn't work for you, please supply a complete self-contained test = case. > (3) Specifying a pattern for FILE seems to work just fine unless one do= es a > recursive search. Sorry, I don't understand the problem here. Can you supply a complete,=20 self-contained test case? > (4) If one attempts to do a recursive search and omits the starting > directory, it would be helpful if the default were the current working > directory. grep does that; at least grep 3.1 does. Perhaps you have an older version= ; if=20 so, please upgrade. For example: $ mkdir d $ echo x >d/x $ cd d $ grep -r x x:x > (5) If one provides an invalid regex, e.g., something like '*xyz' (a re= gex > can't begin with '*'), one should get a fatal error (grep and egrep acc= ept > such a > regex without complaint, and simply return no results). The longstanding (i.e., since the late 1970s) tradition here is to treat = those=20 strings as valid regular expressions, e.g., '*' at the start of a regular= =20 expression is treated as if it were '\*'. Many users expect this behavior= now,=20 so we're unlikely to change it. POSIX allows this behavior as an extensio= n. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 01 02:44:34 2020 Received: (at 31705-done) by debbugs.gnu.org; 1 Jan 2020 07:44:34 +0000 Received: from localhost ([127.0.0.1]:35586 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imYgE-0006R6-Ju for submit@debbugs.gnu.org; Wed, 01 Jan 2020 02:44:34 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48818) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1imYgD-0006Qo-1n for 31705-done@debbugs.gnu.org; Wed, 01 Jan 2020 02:44:33 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 8199016022A; Tue, 31 Dec 2019 23:44:27 -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 YgZdIPf6RAWk; Tue, 31 Dec 2019 23:44:26 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E302A16008F; Tue, 31 Dec 2019 23:44:26 -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 IevsihTuqH-w; Tue, 31 Dec 2019 23:44:26 -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 BBB3816022A; Tue, 31 Dec 2019 23:44:26 -0800 (PST) Subject: Re: bug#31705: five grep / egrep issues From: Paul Eggert To: Phillip Feldman References: Organization: UCLA Computer Science Department Message-ID: <34e6f1e7-0d7b-e880-d23b-b1bebe4b5afa@cs.ucla.edu> Date: Tue, 31 Dec 2019 23:44:26 -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-Debbugs-Envelope-To: 31705-done Cc: 31705-done@debbugs.gnu.org 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 (---) No further comment for over a year, so closing the bug report. From unknown Wed Jun 18 23:03:22 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 29 Jan 2020 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator