From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 24 14:26:17 2019 Received: (at submit) by debbugs.gnu.org; 24 Oct 2019 18:26:17 +0000 Received: from localhost ([127.0.0.1]:36909 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iNhoP-0000EO-Bj for submit@debbugs.gnu.org; Thu, 24 Oct 2019 14:26:17 -0400 Received: from lists.gnu.org ([209.51.188.17]:35568) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iNhoN-0000EG-EL for submit@debbugs.gnu.org; Thu, 24 Oct 2019 14:26:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49284) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iNhoM-0001pp-3a for bug-grep@gnu.org; Thu, 24 Oct 2019 14:26:15 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_50, DOS_RCVD_IP_TWICE_B, RCVD_IN_DNSWL_MED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iNhoK-0004Uw-Op for bug-grep@gnu.org; Thu, 24 Oct 2019 14:26:13 -0400 Received: from freefriends.org ([96.88.95.60]:41498) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iNhoK-0004Uk-Hu for bug-grep@gnu.org; Thu, 24 Oct 2019 14:26:12 -0400 X-Envelope-From: karl@freefriends.org X-Envelope-To: Received: from freefriends.org (freefriends.org [96.88.95.60]) by freefriends.org (8.14.7/8.14.7) with ESMTP id x9OIQADi027468 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 24 Oct 2019 12:26:11 -0600 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id x9OIQATG027467; Thu, 24 Oct 2019 12:26:10 -0600 Date: Thu, 24 Oct 2019 12:26:10 -0600 Message-Id: <201910241826.x9OIQATG027467@freefriends.org> From: Karl Berry To: bug-grep@gnu.org Subject: --no-ignore-case option X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 96.88.95.60 X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit 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.4 (--) I suggest adding --no-ignore-case to clear the case-insensitivity -i search. I, and surely many others, have an alias or script that runs grep with -i by default, along with other options (since GREP_OPTIONS was killed). It would be highly convenient to be able to add --no-ignore-case on the fly to the rare-in-my-experience invocations where case sensitivity is desired. (Also, just in principle, it seems like any boolean option should be switchable by successive options. But I won't go that far.) Besides, since I'm not sending a patch (sorry), my expectation is that there will never be enough time to implement random minor suggestions like this, so it doesn't matter :). Thanks, Karl From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 24 16:40:31 2019 Received: (at 37907) by debbugs.gnu.org; 24 Oct 2019 20:40:31 +0000 Received: from localhost ([127.0.0.1]:36999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iNjuJ-0003TK-AB for submit@debbugs.gnu.org; Thu, 24 Oct 2019 16:40:31 -0400 Received: from freefriends.org ([96.88.95.60]:53088) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iNjuG-0003TB-W6 for 37907@debbugs.gnu.org; Thu, 24 Oct 2019 16:40:29 -0400 X-Envelope-From: arnold@skeeve.com Received: from freefriends.org (freefriends.org [96.88.95.60]) by freefriends.org (8.14.7/8.14.7) with ESMTP id x9OKeRW9032164 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Oct 2019 14:40:28 -0600 Received: (from arnold@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id x9OKeQoK032162; Thu, 24 Oct 2019 14:40:26 -0600 From: arnold@skeeve.com Message-Id: <201910242040.x9OKeQoK032162@freefriends.org> X-Authentication-Warning: frenzy.freefriends.org: arnold set sender to arnold@skeeve.com using -f Date: Thu, 24 Oct 2019 14:40:26 -0600 To: karl@freefriends.org, 37907@debbugs.gnu.org Subject: Re: bug#37907: --no-ignore-case option References: <201910241826.x9OIQATG027467@freefriends.org> In-Reply-To: <201910241826.x9OIQATG027467@freefriends.org> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=_5db20c3a.JBXzIq8RaM3wd/Zgz6FsmXYjKqJStmJz81tOvgm/RfUkWBu7" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37907 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 (---) This is a multi-part message in MIME format. --=_5db20c3a.JBXzIq8RaM3wd/Zgz6FsmXYjKqJStmJz81tOvgm/RfUkWBu7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Karl. See the attached patch. Less than 10 minutes' work. :-) Grep guys - I'm pretty sure I've signed papwerwork for grep. Feel free to incorporate this patch. I chose '-g' since that letter was unused. It has no mnemonic value. Thanks, Arnold Karl Berry wrote: > I suggest adding --no-ignore-case to clear the case-insensitivity -i > search. I, and surely many others, have an alias or script that runs > grep with -i by default, along with other options (since GREP_OPTIONS > was killed). It would be highly convenient to be able to add > --no-ignore-case on the fly to the rare-in-my-experience invocations > where case sensitivity is desired. > > (Also, just in principle, it seems like any boolean option should be > switchable by successive options. But I won't go that far.) > > Besides, since I'm not sending a patch (sorry), my expectation is that > there will never be enough time to implement random minor suggestions > like this, so it doesn't matter :). > > Thanks, > Karl --=_5db20c3a.JBXzIq8RaM3wd/Zgz6FsmXYjKqJStmJz81tOvgm/RfUkWBu7 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="grep.diff" diff --git a/doc/grep.in.1 b/doc/grep.in.1 index a2cbf5c..733647e 100644 --- a/doc/grep.in.1 +++ b/doc/grep.in.1 @@ -254,6 +254,12 @@ Ignore case distinctions in patterns and input data, so that characters that differ only in case match each other. .TP +.BR \-g ", " \-\^\-no\-ignore\-case +Don't ignore case distinctions in patterns and input data. +This option is useful for passing to shell scripts that already use +.BR \-i , +in order to cancel its effects. +.TP .BR \-v ", " \-\^\-invert\-match Invert the sense of matching, to select non-matching lines. .TP diff --git a/doc/grep.texi b/doc/grep.texi index f5edc72..a004639 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -215,6 +215,14 @@ SHARP S) even though lowercasing the latter yields the former. @option{-y} is an obsolete synonym that is provided for compatibility. (@option{-i} is specified by POSIX.) +@item -g +@itemx --no-ignore-case +@opindex -g +@opindex --no-ignore-case +Don't ignore case distinctions in patterns and input data. +This option is useful for passing to shell scripts that already use +@option{-i}, in order to cancel its effects. + @item -v @itemx --invert-match @opindex -v diff --git a/src/grep.c b/src/grep.c index 6f35f26..379d9e1 100644 --- a/src/grep.c +++ b/src/grep.c @@ -411,7 +411,7 @@ static struct exclude *excluded_patterns[2]; static struct exclude *excluded_directory_patterns[2]; /* Short options. */ static char const short_options[] = -"0123456789A:B:C:D:EFGHIPTUVX:abcd:e:f:hiLlm:noqRrsuvwxyZz"; +"0123456789A:B:C:D:EFGHIPTUVX:abcd:e:f:ghiLlm:noqRrsuvwxyZz"; /* Non-boolean long options that have no corresponding short equivalents. */ enum @@ -455,6 +455,7 @@ static struct option const long_options[] = {"help", no_argument, &show_help, 1}, {"include", required_argument, NULL, INCLUDE_OPTION}, {"ignore-case", no_argument, NULL, 'i'}, + {"no-ignore-case", no_argument, NULL, 'g'}, {"initial-tab", no_argument, NULL, 'T'}, {"label", required_argument, NULL, LABEL_OPTION}, {"line-buffered", no_argument, NULL, LINE_BUFFERED_OPTION}, @@ -2616,6 +2617,10 @@ main (int argc, char **argv) match_icase = true; break; + case 'g': + match_icase = false; + break; + case 'L': /* Like -l, except list files that don't contain matches. Inspired by the same option in Hume's gre. */ --=_5db20c3a.JBXzIq8RaM3wd/Zgz6FsmXYjKqJStmJz81tOvgm/RfUkWBu7-- From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 24 17:28:04 2019 Received: (at 37907) by debbugs.gnu.org; 24 Oct 2019 21:28:04 +0000 Received: from localhost ([127.0.0.1]:37052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iNkeK-0004fl-4V for submit@debbugs.gnu.org; Thu, 24 Oct 2019 17:28:04 -0400 Received: from freefriends.org ([96.88.95.60]:53776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iNkeH-0004fM-Nc for 37907@debbugs.gnu.org; Thu, 24 Oct 2019 17:28:02 -0400 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (freefriends.org [96.88.95.60]) by freefriends.org (8.14.7/8.14.7) with ESMTP id x9OLRwWO002222 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Oct 2019 15:27:59 -0600 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id x9OLRwVD002221; Thu, 24 Oct 2019 15:27:58 -0600 Date: Thu, 24 Oct 2019 15:27:58 -0600 Message-Id: <201910242127.x9OLRwVD002221@freefriends.org> From: Karl Berry To: arnold@skeeve.com Subject: Re: bug#37907: --no-ignore-case option In-Reply-To: <201910242040.x9OKeQoK032162@freefriends.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37907 Cc: 37907@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 (---) See the attached patch. Less than 10 minutes' work. :-) Thanks Arnold! Grep guys - I'm pretty sure I've signed papwerwork for grep. copyright.list confirms that you have :). I chose '-g' since that letter was unused. It has no mnemonic value. If a one-letter option is going to be used (I thought that might be too intrusive), I suggest -j, as being next to -i. It's also unused. Thanks again, Karl From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 24 17:37:48 2019 Received: (at control) by debbugs.gnu.org; 24 Oct 2019 21:37:48 +0000 Received: from localhost ([127.0.0.1]:37057 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iNknk-0004uy-3X for submit@debbugs.gnu.org; Thu, 24 Oct 2019 17:37:48 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:41134) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iNkni-0004uh-0E for control@debbugs.gnu.org; Thu, 24 Oct 2019 17:37:46 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E3BDD160704 for ; Thu, 24 Oct 2019 14:37:39 -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 rZGrSiJVkEbY for ; Thu, 24 Oct 2019 14:37:39 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 51A681606FB for ; Thu, 24 Oct 2019 14:37:39 -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 OoA4k4jVqRXY for ; Thu, 24 Oct 2019 14:37:39 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 396D016070D for ; Thu, 24 Oct 2019 14:37:39 -0700 (PDT) To: GNU bug control From: Paul Eggert Subject: 37907 has a patch Organization: UCLA Computer Science Department Message-ID: <0712c2dc-f043-4715-d16c-7b76d4492b3e@cs.ucla.edu> Date: Thu, 24 Oct 2019 14:37:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed 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 (---) tags 37907 patch From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 24 17:42:03 2019 Received: (at 37907) by debbugs.gnu.org; 24 Oct 2019 21:42:04 +0000 Received: from localhost ([127.0.0.1]:37062 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iNkrr-00051f-KZ for submit@debbugs.gnu.org; Thu, 24 Oct 2019 17:42:03 -0400 Received: from freefriends.org ([96.88.95.60]:53976) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iNkrq-00051L-6h for 37907@debbugs.gnu.org; Thu, 24 Oct 2019 17:42:02 -0400 X-Envelope-From: arnold@skeeve.com Received: from freefriends.org (freefriends.org [96.88.95.60]) by freefriends.org (8.14.7/8.14.7) with ESMTP id x9OLfw9B002952 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Oct 2019 15:41:59 -0600 Received: (from arnold@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id x9OLfwHk002951; Thu, 24 Oct 2019 15:41:58 -0600 From: arnold@skeeve.com Message-Id: <201910242141.x9OLfwHk002951@freefriends.org> X-Authentication-Warning: frenzy.freefriends.org: arnold set sender to arnold@skeeve.com using -f Date: Thu, 24 Oct 2019 15:41:58 -0600 To: karl@freefriends.org, arnold@skeeve.com Subject: Re: bug#37907: --no-ignore-case option References: <201910242127.x9OLRwVD002221@freefriends.org> In-Reply-To: <201910242127.x9OLRwVD002221@freefriends.org> User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37907 Cc: 37907@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 (---) Karl Berry wrote: > See the attached patch. Less than 10 minutes' work. :-) > > Thanks Arnold! You're welcome. > I chose '-g' since that letter was unused. It has no mnemonic value. > > If a one-letter option is going to be used (I thought that might be too > intrusive), I suggest -j, as being next to -i. It's also unused. I have no objection. Thanks, Arnold From debbugs-submit-bounces@debbugs.gnu.org Tue Nov 05 18:38:27 2019 Received: (at 37907-done) by debbugs.gnu.org; 5 Nov 2019 23:38:27 +0000 Received: from localhost ([127.0.0.1]:39227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iS8P2-0006AP-2p for submit@debbugs.gnu.org; Tue, 05 Nov 2019 18:38:26 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:42954) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iS8Oy-0006A7-Op for 37907-done@debbugs.gnu.org; Tue, 05 Nov 2019 18:38:22 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6E9B016056C; Tue, 5 Nov 2019 15:38:14 -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 SXxjmraeYkIX; Tue, 5 Nov 2019 15:38:13 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 53982160281; Tue, 5 Nov 2019 15:38:13 -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 HnsA9X_BKvhJ; Tue, 5 Nov 2019 15:38:13 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 3336416056C; Tue, 5 Nov 2019 15:38:13 -0800 (PST) Subject: Re: bug#37907: --no-ignore-case option To: arnold@skeeve.com References: <201910241826.x9OIQATG027467@freefriends.org> <201910242040.x9OKeQoK032162@freefriends.org> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Tue, 5 Nov 2019 15:38:12 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <201910242040.x9OKeQoK032162@freefriends.org> Content-Type: multipart/mixed; boundary="------------5C017CB30B6E2E1E2645A47E" Content-Language: en-US X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 37907-done Cc: 37907-done@debbugs.gnu.org, karl@freefriends.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 (---) This is a multi-part message in MIME format. --------------5C017CB30B6E2E1E2645A47E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 10/24/19 1:40 PM, arnold@skeeve.com wrote: > I chose '-g' since that letter was unused. It has no mnemonic value. Thanks for implementing that. Other grep-like programs tend to use -I for this option, since it negates -i. Obviously we can't do that right now since -I means --binary-files=without-match to GNU grep. So I installed the attached, which takes the more-conservative approach of implementing just --no-ignore-case without any single-letter option. Perhaps in the future we could deprecate -I and then eventually repurpose it? But in the meantime this particular feature request is done, so I'm taking the liberty of closing the bug report. --------------5C017CB30B6E2E1E2645A47E Content-Type: text/x-patch; charset=UTF-8; name="0001-grep-new-no-ignore-case-option.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-grep-new-no-ignore-case-option.patch" >From d3a7315d770897dfb3cd826f399d822b1b771d0b Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 5 Nov 2019 15:32:58 -0800 Subject: [PATCH] grep: new --no-ignore-case option Suggested by Karl Berry and mostly implemented by Arnold Robbins (Bug#37907). * NEWS: * doc/grep.in.1: * doc/grep.texi (Matching Control): * src/grep.c (usage): Document the new option. * src/grep.c (NO_IGNORE_CASE_OPTION): New constant. (long_options, main): Support new option. --- NEWS | 5 +++++ doc/grep.in.1 | 9 ++++++++- doc/grep.texi | 7 +++++++ src/grep.c | 9 ++++++++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 9ce65b3..c31c600 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ GNU grep NEWS -*- outline -*- * Noteworthy changes in release ?.? (????-??-??) [?] +** New features + + The new --no-ignore-case option causes grep to observe case + distinctions, overriding any previous -i (--ignore-case) option. + ** Bug fixes The exit status of 'grep -L' is no longer incorrect when standard diff --git a/doc/grep.in.1 b/doc/grep.in.1 index a2cbf5c..219f37f 100644 --- a/doc/grep.in.1 +++ b/doc/grep.in.1 @@ -254,6 +254,13 @@ Ignore case distinctions in patterns and input data, so that characters that differ only in case match each other. .TP +.B \-\^\-no\-ignore\-case +Do not ignore case distinctions in patterns and input data. +This is the default. +This option is useful for passing to shell scripts that already use +.BR \-i , +to cancel its effects because the two options override each other. +.TP .BR \-v ", " \-\^\-invert\-match Invert the sense of matching, to select non-matching lines. .TP @@ -683,7 +690,7 @@ Follow all symbolic links, unlike .BR \-r . .SS "Other Options" .TP -.BR \-\^\-line\-buffered +.B \-\^\-line\-buffered Use line buffering on output. This can cause a performance penalty. .TP diff --git a/doc/grep.texi b/doc/grep.texi index f5edc72..01ad5f7 100644 --- a/doc/grep.texi +++ b/doc/grep.texi @@ -215,6 +215,13 @@ SHARP S) even though lowercasing the latter yields the former. @option{-y} is an obsolete synonym that is provided for compatibility. (@option{-i} is specified by POSIX.) +@item --no-ignore-case +@opindex --no-ignore-case +Do not ignore case distinctions in patterns and input data. This is +the default. This option is useful for passing to shell scripts that +already use @option{-i}, in order to cancel its effects because the +two options override each other. + @item -v @itemx --invert-match @opindex -v diff --git a/src/grep.c b/src/grep.c index 7f3ada1..edf90ab 100644 --- a/src/grep.c +++ b/src/grep.c @@ -424,7 +424,8 @@ enum GROUP_SEPARATOR_OPTION, INCLUDE_OPTION, LINE_BUFFERED_OPTION, - LABEL_OPTION + LABEL_OPTION, + NO_IGNORE_CASE_OPTION }; /* Long options equivalences. */ @@ -455,6 +456,7 @@ static struct option const long_options[] = {"help", no_argument, &show_help, 1}, {"include", required_argument, NULL, INCLUDE_OPTION}, {"ignore-case", no_argument, NULL, 'i'}, + {"no-ignore-case", no_argument, NULL, NO_IGNORE_CASE_OPTION}, {"initial-tab", no_argument, NULL, 'T'}, {"label", required_argument, NULL, LABEL_OPTION}, {"line-buffered", no_argument, NULL, LINE_BUFFERED_OPTION}, @@ -1927,6 +1929,7 @@ Pattern selection and interpretation:\n"), getprogname ()); -e, --regexp=PATTERNS use PATTERNS for matching\n\ -f, --file=FILE take PATTERNS from FILE\n\ -i, --ignore-case ignore case distinctions in patterns and data\n\ + --no-ignore-case do not ignore case distinctions (default)\n\ -w, --word-regexp match only whole words\n\ -x, --line-regexp match only whole lines\n\ -z, --null-data a data line ends in 0 byte, not newline\n")); @@ -2617,6 +2620,10 @@ main (int argc, char **argv) match_icase = true; break; + case NO_IGNORE_CASE_OPTION: + match_icase = false; + break; + case 'L': /* Like -l, except list files that don't contain matches. Inspired by the same option in Hume's gre. */ -- 2.23.0 --------------5C017CB30B6E2E1E2645A47E-- From debbugs-submit-bounces@debbugs.gnu.org Wed Nov 06 05:35:49 2019 Received: (at 37907-done) by debbugs.gnu.org; 6 Nov 2019 10:35:49 +0000 Received: from localhost ([127.0.0.1]:39502 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iSIfF-0005u2-IV for submit@debbugs.gnu.org; Wed, 06 Nov 2019 05:35:49 -0500 Received: from freefriends.org ([96.88.95.60]:35458) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iSIfD-0005tu-AC for 37907-done@debbugs.gnu.org; Wed, 06 Nov 2019 05:35:48 -0500 X-Envelope-From: arnold@skeeve.com Received: from freefriends.org (freefriends.org [96.88.95.60]) by freefriends.org (8.14.7/8.14.7) with ESMTP id xA6AZZcB014548 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 6 Nov 2019 03:35:36 -0700 Received: (from arnold@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id xA6AZZ2u014547; Wed, 6 Nov 2019 03:35:35 -0700 From: arnold@skeeve.com Message-Id: <201911061035.xA6AZZ2u014547@freefriends.org> X-Authentication-Warning: frenzy.freefriends.org: arnold set sender to arnold@skeeve.com using -f Date: Wed, 06 Nov 2019 03:35:35 -0700 To: eggert@cs.ucla.edu, arnold@skeeve.com Subject: Re: bug#37907: --no-ignore-case option References: <201910241826.x9OIQATG027467@freefriends.org> <201910242040.x9OKeQoK032162@freefriends.org> In-Reply-To: User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 37907-done Cc: 37907-done@debbugs.gnu.org, karl@freefriends.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: -1.5 (-) Paul Eggert wrote: > On 10/24/19 1:40 PM, arnold@skeeve.com wrote: > > > I chose '-g' since that letter was unused. It has no mnemonic value. > > Thanks for implementing that. Other grep-like programs tend to use -I > for this option, since it negates -i. Obviously we can't do that right > now since -I means --binary-files=without-match to GNU grep. So I > installed the attached, which takes the more-conservative approach of > implementing just --no-ignore-case without any single-letter option. > Perhaps in the future we could deprecate -I and then eventually > repurpose it? But in the meantime this particular feature request is > done, so I'm taking the liberty of closing the bug report. Much thanks, Paul. Karl --- Enjoy! :-) Arnold From unknown Sun Aug 17 10:16:46 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, 04 Dec 2019 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