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. */