Is grep documentation about ignoring case wrong, since it doesn't ignore case in filenames? ...

What is a fractional matching?

Generate an RGB colour grid

How often does castling occur in grandmaster games?

What would you call this weird metallic apparatus that allows you to lift people?

How to tell that you are a giant?

When a candle burns, why does the top of wick glow if bottom of flame is hottest?

If Windows 7 doesn't support WSL, then what does Linux subsystem option mean?

Take 2! Is this homebrew Lady of Pain warlock patron balanced?

Illegal assignment from sObject to Id

How do living politicians protect their readily obtainable signatures from misuse?

How can I reduce the gap between left and right of cdot with a macro?

How to react to hostile behavior from a senior developer?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

Why do we bend a book to keep it straight?

How come Sam didn't become Lord of Horn Hill?

Is CEO the "profession" with the most psychopaths?

Is there any word for a place full of confusion?

Why wasn't DOSKEY integrated with COMMAND.COM?

Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?

Why does the remaining Rebel fleet at the end of Rogue One seem dramatically larger than the one in A New Hope?

Putting class ranking in CV, but against dept guidelines

Sum letters are not two different

What is the topology associated with the algebras for the ultrafilter monad?

Using audio cues to encourage good posture



Is grep documentation about ignoring case wrong, since it doesn't ignore case in filenames?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questiongrep and brackets in textgrep: Ignoring GREP_OPTIONS to search case-sensitiveHow to Get FreeBSD Grep to recognize '-' option?Grep on single lineHow to find/grep what is between string1 and string2?What does a “*” at the start of a regular expression do?Recursive Grep with filename pattern specifiedquote files matched by grepGrepping on du -h for all the files that are larger than 1GBDoes grep --color default to =auto or =always?





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







4















The man page for grep reads




-i, --ignore-case



      Ignore case distinctions in both the PATTERN and the input files. 
      (-i is specified by POSIX.)



However, if I change case on a filename, it won't work.



$ touch WHATEVER
$ grep -i pattern whatever
grep: whatever: No such file or directory


Am I missing something?










share|improve this question









New contributor




grep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Comments are not for extended discussion; this conversation has been moved to chat.

    – terdon
    15 hours ago






  • 5





    That switch is talking about the content of the file, not its name. The accepted answer does not at all address the problem shown here.

    – Monty Harder
    11 hours ago











  • @MontyHarder The accepted answer implicitly confirms that the wording is confusing and supports that this is a non-issue in the new version.

    – grep
    10 hours ago






  • 2





    @grep The problem you present is the non-existence of whatever, which the accepted answer does not in any way address. I am not aware of any version of grep that will look in WHATEVER when you ask it to look in whatever, under any circumstances. The accepted answer addresses grep -i PATTERN whatever, which is not grep -i pattern WHATEVER. Case-sensitivity of filenames is a *nix thing, not a grep thing.

    – Monty Harder
    8 hours ago













  • I would never have considered the -i parameter to apply to the filename, based on reading either man page line.

    – Criggie
    4 hours ago


















4















The man page for grep reads




-i, --ignore-case



      Ignore case distinctions in both the PATTERN and the input files. 
      (-i is specified by POSIX.)



However, if I change case on a filename, it won't work.



$ touch WHATEVER
$ grep -i pattern whatever
grep: whatever: No such file or directory


Am I missing something?










share|improve this question









New contributor




grep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Comments are not for extended discussion; this conversation has been moved to chat.

    – terdon
    15 hours ago






  • 5





    That switch is talking about the content of the file, not its name. The accepted answer does not at all address the problem shown here.

    – Monty Harder
    11 hours ago











  • @MontyHarder The accepted answer implicitly confirms that the wording is confusing and supports that this is a non-issue in the new version.

    – grep
    10 hours ago






  • 2





    @grep The problem you present is the non-existence of whatever, which the accepted answer does not in any way address. I am not aware of any version of grep that will look in WHATEVER when you ask it to look in whatever, under any circumstances. The accepted answer addresses grep -i PATTERN whatever, which is not grep -i pattern WHATEVER. Case-sensitivity of filenames is a *nix thing, not a grep thing.

    – Monty Harder
    8 hours ago













  • I would never have considered the -i parameter to apply to the filename, based on reading either man page line.

    – Criggie
    4 hours ago














4












4








4








The man page for grep reads




-i, --ignore-case



      Ignore case distinctions in both the PATTERN and the input files. 
      (-i is specified by POSIX.)



However, if I change case on a filename, it won't work.



$ touch WHATEVER
$ grep -i pattern whatever
grep: whatever: No such file or directory


Am I missing something?










share|improve this question









New contributor




grep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












The man page for grep reads




-i, --ignore-case



      Ignore case distinctions in both the PATTERN and the input files. 
      (-i is specified by POSIX.)



However, if I change case on a filename, it won't work.



$ touch WHATEVER
$ grep -i pattern whatever
grep: whatever: No such file or directory


Am I missing something?







grep documentation






share|improve this question









New contributor




grep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




grep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 11 hours ago









muru

38k590166




38k590166






New contributor




grep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked yesterday









grepgrep

454




454




New contributor




grep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





grep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






grep is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Comments are not for extended discussion; this conversation has been moved to chat.

    – terdon
    15 hours ago






  • 5





    That switch is talking about the content of the file, not its name. The accepted answer does not at all address the problem shown here.

    – Monty Harder
    11 hours ago











  • @MontyHarder The accepted answer implicitly confirms that the wording is confusing and supports that this is a non-issue in the new version.

    – grep
    10 hours ago






  • 2





    @grep The problem you present is the non-existence of whatever, which the accepted answer does not in any way address. I am not aware of any version of grep that will look in WHATEVER when you ask it to look in whatever, under any circumstances. The accepted answer addresses grep -i PATTERN whatever, which is not grep -i pattern WHATEVER. Case-sensitivity of filenames is a *nix thing, not a grep thing.

    – Monty Harder
    8 hours ago













  • I would never have considered the -i parameter to apply to the filename, based on reading either man page line.

    – Criggie
    4 hours ago



















  • Comments are not for extended discussion; this conversation has been moved to chat.

    – terdon
    15 hours ago






  • 5





    That switch is talking about the content of the file, not its name. The accepted answer does not at all address the problem shown here.

    – Monty Harder
    11 hours ago











  • @MontyHarder The accepted answer implicitly confirms that the wording is confusing and supports that this is a non-issue in the new version.

    – grep
    10 hours ago






  • 2





    @grep The problem you present is the non-existence of whatever, which the accepted answer does not in any way address. I am not aware of any version of grep that will look in WHATEVER when you ask it to look in whatever, under any circumstances. The accepted answer addresses grep -i PATTERN whatever, which is not grep -i pattern WHATEVER. Case-sensitivity of filenames is a *nix thing, not a grep thing.

    – Monty Harder
    8 hours ago













  • I would never have considered the -i parameter to apply to the filename, based on reading either man page line.

    – Criggie
    4 hours ago

















Comments are not for extended discussion; this conversation has been moved to chat.

– terdon
15 hours ago





Comments are not for extended discussion; this conversation has been moved to chat.

– terdon
15 hours ago




5




5





That switch is talking about the content of the file, not its name. The accepted answer does not at all address the problem shown here.

– Monty Harder
11 hours ago





That switch is talking about the content of the file, not its name. The accepted answer does not at all address the problem shown here.

– Monty Harder
11 hours ago













@MontyHarder The accepted answer implicitly confirms that the wording is confusing and supports that this is a non-issue in the new version.

– grep
10 hours ago





@MontyHarder The accepted answer implicitly confirms that the wording is confusing and supports that this is a non-issue in the new version.

– grep
10 hours ago




2




2





@grep The problem you present is the non-existence of whatever, which the accepted answer does not in any way address. I am not aware of any version of grep that will look in WHATEVER when you ask it to look in whatever, under any circumstances. The accepted answer addresses grep -i PATTERN whatever, which is not grep -i pattern WHATEVER. Case-sensitivity of filenames is a *nix thing, not a grep thing.

– Monty Harder
8 hours ago







@grep The problem you present is the non-existence of whatever, which the accepted answer does not in any way address. I am not aware of any version of grep that will look in WHATEVER when you ask it to look in whatever, under any circumstances. The accepted answer addresses grep -i PATTERN whatever, which is not grep -i pattern WHATEVER. Case-sensitivity of filenames is a *nix thing, not a grep thing.

– Monty Harder
8 hours ago















I would never have considered the -i parameter to apply to the filename, based on reading either man page line.

– Criggie
4 hours ago





I would never have considered the -i parameter to apply to the filename, based on reading either man page line.

– Criggie
4 hours ago










4 Answers
4






active

oldest

votes


















13














That confusing snippet was changed in newer versions of GNU grep to:




-i, -ignore-case
Ignore case distinctions, so that characters that differ only in case match each other.




See this commit: http://git.savannah.gnu.org/cgit/grep.git/commit/?id=e1ca01be48cb64e5eaa6b5b29910e7eea1719f91



 .BR -i ", " -^-ignore-case
-Ignore case distinctions in both the
-.I PATTERN
-and the input files.
+Ignore case distinctions, so that characters that differ only in case
+match each other.




As to where the old formulation may originate, some programs like less(1) have a (mis)feature[1] where using an uppercase letter in a pattern will turn off case insensitivity for a particular search (override the -i flag). The author of that doc snippet probably assumed that many people expected that behavior, and instead of some direct caveat, preferred that non-committal sentence. FWIW, such a feature was never a part of ed(1), grep(1), vi(1), perl(1) etc. or of the regex(3) or pcre(3) APIs.



[1] that seems to have its origins in emacs, where it's the default; there you can turn it off by setting the (customizable) search-upper-case variable to nil.






share|improve this answer


























  • Do you mind opening that link in private mode finding that part of the doc? I just went through all ten occurrences of "ignore" and couldn't find that bit.

    – grep
    yesterday











  • sorry for the mixup

    – mosvy
    yesterday






  • 1





    I find the less behaviour very useful. I would never use uppercase characters in my search query if I intended the search to be case sensitive. It's a sensible default IMO

    – Stéphane Chazelas
    14 hours ago






  • 1





    You can get all those behaviours in less by entering -i and -I within less. The default is case-sensitive, -i is the default chosen by mandb, git, and IMO is useful. For a complete case insensitive (like for your copy-paste case), there's -I. vim has the smartcase option as an equivalent of less -i behaviour. GNU info and GNU emacs behave like less -i in this instance.

    – Stéphane Chazelas
    10 hours ago








  • 1





    What does any of this have to do with mis-cased filenames?

    – Monty Harder
    8 hours ago



















6














Apparently I have a different manpage.



   -i, --ignore-case
Ignore case distinctions, so that characters that differ only in
case match each other.


In any case, it's not about the filenames.



It ignores case in the file (contents) but also in the pattern.



Test file:



___________
Hello World
^^^^^^^^^^^


Grep results (ignore case of file contents):



$ grep hello test.txt 

$ grep Hello test.txt
Hello World
$ grep -i HELLO test.txt
Hello World
$ grep -i hello test.txt
Hello World


Grep results (ignore case of pattern):



$ grep [a-Z] test.txt 
grep: Invalid range end
$ grep -i [a-Z] test.txt
Hello World
$ grep -i [A-z] test.txt
Hello World
$ grep [A-z] test.txt
___________
Hello World
^^^^^^^^^^^


As you can see the results can sometimes be a little unexpected.



Not sure if there is an example where this actually matters more.






share|improve this answer



















  • 1





    "It ignores case in the file (contents) but also in the pattern", this suggests (although it doesn't necessarily say it), that it is possible to ignore case in the pattern, but not in the contents. I'd like to understand how this would work (ignoring pattern, but not contents -- or the other way around).

    – grep
    yesterday








  • 2





    In less, for example, there's a -i mode in which matching is case-insensitive if you only use lowercase letters in the pattern, but if there are any uppercase letters in the pattern, the whole thing is case-sensitive. That's like (sometimes) ignoring case in the contents but not the pattern.

    – Wumpus Q. Wumbley
    yesterday











  • less is an interactive program quite unlike grep, not sure how it relates at all. interactive programs make usability choices, like nano where you can change case-sensitivity by hotkey. As for the manpage I think the old text actually explained it better, the new one does not make clear the pattern meaning itself changes too (even if [A-z] example is a bit constructed, the match result is completely different, so it should be in the manpage, but isn't anymore).

    – frostschutz
    16 hours ago





















6















"It ignores case in the file (contents) but also in the pattern",
this suggests (although it doesn't necessarily say it),
that it is possible to ignore case in the pattern, but not in the contents. 
I'd like to understand how this would work
(ignoring pattern, but not contents -- or the other way around).




Well, for example, it could be written
so that a pattern of “hello” would match “Hello” in the file,
but not vice versa. 
While this sounds hypothetical, it is the way spell-check works. 
If your dictionary contains “stack” and “exchange”,
and your document contains “Stack Exchange”,
spell-check will succeed without error. 
But if your dictionary contains “Unix” and your document contains “unix”,
that will be flagged as an error.






share|improve this answer































    6














    Using the -i flag ignores the case of the matches, not the case of the filenames. You created a file whose name is all uppercase, but you told grep to open a file whose name is lowercase, leading to the "file not found" error message. Linux filenames are case-sensitive.






    share|improve this answer
























      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });






      grep is a new contributor. Be nice, and check out our Code of Conduct.










      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f513108%2fis-grep-documentation-about-ignoring-case-wrong-since-it-doesnt-ignore-case-in%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      13














      That confusing snippet was changed in newer versions of GNU grep to:




      -i, -ignore-case
      Ignore case distinctions, so that characters that differ only in case match each other.




      See this commit: http://git.savannah.gnu.org/cgit/grep.git/commit/?id=e1ca01be48cb64e5eaa6b5b29910e7eea1719f91



       .BR -i ", " -^-ignore-case
      -Ignore case distinctions in both the
      -.I PATTERN
      -and the input files.
      +Ignore case distinctions, so that characters that differ only in case
      +match each other.




      As to where the old formulation may originate, some programs like less(1) have a (mis)feature[1] where using an uppercase letter in a pattern will turn off case insensitivity for a particular search (override the -i flag). The author of that doc snippet probably assumed that many people expected that behavior, and instead of some direct caveat, preferred that non-committal sentence. FWIW, such a feature was never a part of ed(1), grep(1), vi(1), perl(1) etc. or of the regex(3) or pcre(3) APIs.



      [1] that seems to have its origins in emacs, where it's the default; there you can turn it off by setting the (customizable) search-upper-case variable to nil.






      share|improve this answer


























      • Do you mind opening that link in private mode finding that part of the doc? I just went through all ten occurrences of "ignore" and couldn't find that bit.

        – grep
        yesterday











      • sorry for the mixup

        – mosvy
        yesterday






      • 1





        I find the less behaviour very useful. I would never use uppercase characters in my search query if I intended the search to be case sensitive. It's a sensible default IMO

        – Stéphane Chazelas
        14 hours ago






      • 1





        You can get all those behaviours in less by entering -i and -I within less. The default is case-sensitive, -i is the default chosen by mandb, git, and IMO is useful. For a complete case insensitive (like for your copy-paste case), there's -I. vim has the smartcase option as an equivalent of less -i behaviour. GNU info and GNU emacs behave like less -i in this instance.

        – Stéphane Chazelas
        10 hours ago








      • 1





        What does any of this have to do with mis-cased filenames?

        – Monty Harder
        8 hours ago
















      13














      That confusing snippet was changed in newer versions of GNU grep to:




      -i, -ignore-case
      Ignore case distinctions, so that characters that differ only in case match each other.




      See this commit: http://git.savannah.gnu.org/cgit/grep.git/commit/?id=e1ca01be48cb64e5eaa6b5b29910e7eea1719f91



       .BR -i ", " -^-ignore-case
      -Ignore case distinctions in both the
      -.I PATTERN
      -and the input files.
      +Ignore case distinctions, so that characters that differ only in case
      +match each other.




      As to where the old formulation may originate, some programs like less(1) have a (mis)feature[1] where using an uppercase letter in a pattern will turn off case insensitivity for a particular search (override the -i flag). The author of that doc snippet probably assumed that many people expected that behavior, and instead of some direct caveat, preferred that non-committal sentence. FWIW, such a feature was never a part of ed(1), grep(1), vi(1), perl(1) etc. or of the regex(3) or pcre(3) APIs.



      [1] that seems to have its origins in emacs, where it's the default; there you can turn it off by setting the (customizable) search-upper-case variable to nil.






      share|improve this answer


























      • Do you mind opening that link in private mode finding that part of the doc? I just went through all ten occurrences of "ignore" and couldn't find that bit.

        – grep
        yesterday











      • sorry for the mixup

        – mosvy
        yesterday






      • 1





        I find the less behaviour very useful. I would never use uppercase characters in my search query if I intended the search to be case sensitive. It's a sensible default IMO

        – Stéphane Chazelas
        14 hours ago






      • 1





        You can get all those behaviours in less by entering -i and -I within less. The default is case-sensitive, -i is the default chosen by mandb, git, and IMO is useful. For a complete case insensitive (like for your copy-paste case), there's -I. vim has the smartcase option as an equivalent of less -i behaviour. GNU info and GNU emacs behave like less -i in this instance.

        – Stéphane Chazelas
        10 hours ago








      • 1





        What does any of this have to do with mis-cased filenames?

        – Monty Harder
        8 hours ago














      13












      13








      13







      That confusing snippet was changed in newer versions of GNU grep to:




      -i, -ignore-case
      Ignore case distinctions, so that characters that differ only in case match each other.




      See this commit: http://git.savannah.gnu.org/cgit/grep.git/commit/?id=e1ca01be48cb64e5eaa6b5b29910e7eea1719f91



       .BR -i ", " -^-ignore-case
      -Ignore case distinctions in both the
      -.I PATTERN
      -and the input files.
      +Ignore case distinctions, so that characters that differ only in case
      +match each other.




      As to where the old formulation may originate, some programs like less(1) have a (mis)feature[1] where using an uppercase letter in a pattern will turn off case insensitivity for a particular search (override the -i flag). The author of that doc snippet probably assumed that many people expected that behavior, and instead of some direct caveat, preferred that non-committal sentence. FWIW, such a feature was never a part of ed(1), grep(1), vi(1), perl(1) etc. or of the regex(3) or pcre(3) APIs.



      [1] that seems to have its origins in emacs, where it's the default; there you can turn it off by setting the (customizable) search-upper-case variable to nil.






      share|improve this answer















      That confusing snippet was changed in newer versions of GNU grep to:




      -i, -ignore-case
      Ignore case distinctions, so that characters that differ only in case match each other.




      See this commit: http://git.savannah.gnu.org/cgit/grep.git/commit/?id=e1ca01be48cb64e5eaa6b5b29910e7eea1719f91



       .BR -i ", " -^-ignore-case
      -Ignore case distinctions in both the
      -.I PATTERN
      -and the input files.
      +Ignore case distinctions, so that characters that differ only in case
      +match each other.




      As to where the old formulation may originate, some programs like less(1) have a (mis)feature[1] where using an uppercase letter in a pattern will turn off case insensitivity for a particular search (override the -i flag). The author of that doc snippet probably assumed that many people expected that behavior, and instead of some direct caveat, preferred that non-committal sentence. FWIW, such a feature was never a part of ed(1), grep(1), vi(1), perl(1) etc. or of the regex(3) or pcre(3) APIs.



      [1] that seems to have its origins in emacs, where it's the default; there you can turn it off by setting the (customizable) search-upper-case variable to nil.







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited 8 hours ago

























      answered yesterday









      mosvymosvy

      10.3k11238




      10.3k11238













      • Do you mind opening that link in private mode finding that part of the doc? I just went through all ten occurrences of "ignore" and couldn't find that bit.

        – grep
        yesterday











      • sorry for the mixup

        – mosvy
        yesterday






      • 1





        I find the less behaviour very useful. I would never use uppercase characters in my search query if I intended the search to be case sensitive. It's a sensible default IMO

        – Stéphane Chazelas
        14 hours ago






      • 1





        You can get all those behaviours in less by entering -i and -I within less. The default is case-sensitive, -i is the default chosen by mandb, git, and IMO is useful. For a complete case insensitive (like for your copy-paste case), there's -I. vim has the smartcase option as an equivalent of less -i behaviour. GNU info and GNU emacs behave like less -i in this instance.

        – Stéphane Chazelas
        10 hours ago








      • 1





        What does any of this have to do with mis-cased filenames?

        – Monty Harder
        8 hours ago



















      • Do you mind opening that link in private mode finding that part of the doc? I just went through all ten occurrences of "ignore" and couldn't find that bit.

        – grep
        yesterday











      • sorry for the mixup

        – mosvy
        yesterday






      • 1





        I find the less behaviour very useful. I would never use uppercase characters in my search query if I intended the search to be case sensitive. It's a sensible default IMO

        – Stéphane Chazelas
        14 hours ago






      • 1





        You can get all those behaviours in less by entering -i and -I within less. The default is case-sensitive, -i is the default chosen by mandb, git, and IMO is useful. For a complete case insensitive (like for your copy-paste case), there's -I. vim has the smartcase option as an equivalent of less -i behaviour. GNU info and GNU emacs behave like less -i in this instance.

        – Stéphane Chazelas
        10 hours ago








      • 1





        What does any of this have to do with mis-cased filenames?

        – Monty Harder
        8 hours ago

















      Do you mind opening that link in private mode finding that part of the doc? I just went through all ten occurrences of "ignore" and couldn't find that bit.

      – grep
      yesterday





      Do you mind opening that link in private mode finding that part of the doc? I just went through all ten occurrences of "ignore" and couldn't find that bit.

      – grep
      yesterday













      sorry for the mixup

      – mosvy
      yesterday





      sorry for the mixup

      – mosvy
      yesterday




      1




      1





      I find the less behaviour very useful. I would never use uppercase characters in my search query if I intended the search to be case sensitive. It's a sensible default IMO

      – Stéphane Chazelas
      14 hours ago





      I find the less behaviour very useful. I would never use uppercase characters in my search query if I intended the search to be case sensitive. It's a sensible default IMO

      – Stéphane Chazelas
      14 hours ago




      1




      1





      You can get all those behaviours in less by entering -i and -I within less. The default is case-sensitive, -i is the default chosen by mandb, git, and IMO is useful. For a complete case insensitive (like for your copy-paste case), there's -I. vim has the smartcase option as an equivalent of less -i behaviour. GNU info and GNU emacs behave like less -i in this instance.

      – Stéphane Chazelas
      10 hours ago







      You can get all those behaviours in less by entering -i and -I within less. The default is case-sensitive, -i is the default chosen by mandb, git, and IMO is useful. For a complete case insensitive (like for your copy-paste case), there's -I. vim has the smartcase option as an equivalent of less -i behaviour. GNU info and GNU emacs behave like less -i in this instance.

      – Stéphane Chazelas
      10 hours ago






      1




      1





      What does any of this have to do with mis-cased filenames?

      – Monty Harder
      8 hours ago





      What does any of this have to do with mis-cased filenames?

      – Monty Harder
      8 hours ago













      6














      Apparently I have a different manpage.



         -i, --ignore-case
      Ignore case distinctions, so that characters that differ only in
      case match each other.


      In any case, it's not about the filenames.



      It ignores case in the file (contents) but also in the pattern.



      Test file:



      ___________
      Hello World
      ^^^^^^^^^^^


      Grep results (ignore case of file contents):



      $ grep hello test.txt 

      $ grep Hello test.txt
      Hello World
      $ grep -i HELLO test.txt
      Hello World
      $ grep -i hello test.txt
      Hello World


      Grep results (ignore case of pattern):



      $ grep [a-Z] test.txt 
      grep: Invalid range end
      $ grep -i [a-Z] test.txt
      Hello World
      $ grep -i [A-z] test.txt
      Hello World
      $ grep [A-z] test.txt
      ___________
      Hello World
      ^^^^^^^^^^^


      As you can see the results can sometimes be a little unexpected.



      Not sure if there is an example where this actually matters more.






      share|improve this answer



















      • 1





        "It ignores case in the file (contents) but also in the pattern", this suggests (although it doesn't necessarily say it), that it is possible to ignore case in the pattern, but not in the contents. I'd like to understand how this would work (ignoring pattern, but not contents -- or the other way around).

        – grep
        yesterday








      • 2





        In less, for example, there's a -i mode in which matching is case-insensitive if you only use lowercase letters in the pattern, but if there are any uppercase letters in the pattern, the whole thing is case-sensitive. That's like (sometimes) ignoring case in the contents but not the pattern.

        – Wumpus Q. Wumbley
        yesterday











      • less is an interactive program quite unlike grep, not sure how it relates at all. interactive programs make usability choices, like nano where you can change case-sensitivity by hotkey. As for the manpage I think the old text actually explained it better, the new one does not make clear the pattern meaning itself changes too (even if [A-z] example is a bit constructed, the match result is completely different, so it should be in the manpage, but isn't anymore).

        – frostschutz
        16 hours ago


















      6














      Apparently I have a different manpage.



         -i, --ignore-case
      Ignore case distinctions, so that characters that differ only in
      case match each other.


      In any case, it's not about the filenames.



      It ignores case in the file (contents) but also in the pattern.



      Test file:



      ___________
      Hello World
      ^^^^^^^^^^^


      Grep results (ignore case of file contents):



      $ grep hello test.txt 

      $ grep Hello test.txt
      Hello World
      $ grep -i HELLO test.txt
      Hello World
      $ grep -i hello test.txt
      Hello World


      Grep results (ignore case of pattern):



      $ grep [a-Z] test.txt 
      grep: Invalid range end
      $ grep -i [a-Z] test.txt
      Hello World
      $ grep -i [A-z] test.txt
      Hello World
      $ grep [A-z] test.txt
      ___________
      Hello World
      ^^^^^^^^^^^


      As you can see the results can sometimes be a little unexpected.



      Not sure if there is an example where this actually matters more.






      share|improve this answer



















      • 1





        "It ignores case in the file (contents) but also in the pattern", this suggests (although it doesn't necessarily say it), that it is possible to ignore case in the pattern, but not in the contents. I'd like to understand how this would work (ignoring pattern, but not contents -- or the other way around).

        – grep
        yesterday








      • 2





        In less, for example, there's a -i mode in which matching is case-insensitive if you only use lowercase letters in the pattern, but if there are any uppercase letters in the pattern, the whole thing is case-sensitive. That's like (sometimes) ignoring case in the contents but not the pattern.

        – Wumpus Q. Wumbley
        yesterday











      • less is an interactive program quite unlike grep, not sure how it relates at all. interactive programs make usability choices, like nano where you can change case-sensitivity by hotkey. As for the manpage I think the old text actually explained it better, the new one does not make clear the pattern meaning itself changes too (even if [A-z] example is a bit constructed, the match result is completely different, so it should be in the manpage, but isn't anymore).

        – frostschutz
        16 hours ago
















      6












      6








      6







      Apparently I have a different manpage.



         -i, --ignore-case
      Ignore case distinctions, so that characters that differ only in
      case match each other.


      In any case, it's not about the filenames.



      It ignores case in the file (contents) but also in the pattern.



      Test file:



      ___________
      Hello World
      ^^^^^^^^^^^


      Grep results (ignore case of file contents):



      $ grep hello test.txt 

      $ grep Hello test.txt
      Hello World
      $ grep -i HELLO test.txt
      Hello World
      $ grep -i hello test.txt
      Hello World


      Grep results (ignore case of pattern):



      $ grep [a-Z] test.txt 
      grep: Invalid range end
      $ grep -i [a-Z] test.txt
      Hello World
      $ grep -i [A-z] test.txt
      Hello World
      $ grep [A-z] test.txt
      ___________
      Hello World
      ^^^^^^^^^^^


      As you can see the results can sometimes be a little unexpected.



      Not sure if there is an example where this actually matters more.






      share|improve this answer













      Apparently I have a different manpage.



         -i, --ignore-case
      Ignore case distinctions, so that characters that differ only in
      case match each other.


      In any case, it's not about the filenames.



      It ignores case in the file (contents) but also in the pattern.



      Test file:



      ___________
      Hello World
      ^^^^^^^^^^^


      Grep results (ignore case of file contents):



      $ grep hello test.txt 

      $ grep Hello test.txt
      Hello World
      $ grep -i HELLO test.txt
      Hello World
      $ grep -i hello test.txt
      Hello World


      Grep results (ignore case of pattern):



      $ grep [a-Z] test.txt 
      grep: Invalid range end
      $ grep -i [a-Z] test.txt
      Hello World
      $ grep -i [A-z] test.txt
      Hello World
      $ grep [A-z] test.txt
      ___________
      Hello World
      ^^^^^^^^^^^


      As you can see the results can sometimes be a little unexpected.



      Not sure if there is an example where this actually matters more.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered yesterday









      frostschutzfrostschutz

      27.8k25790




      27.8k25790








      • 1





        "It ignores case in the file (contents) but also in the pattern", this suggests (although it doesn't necessarily say it), that it is possible to ignore case in the pattern, but not in the contents. I'd like to understand how this would work (ignoring pattern, but not contents -- or the other way around).

        – grep
        yesterday








      • 2





        In less, for example, there's a -i mode in which matching is case-insensitive if you only use lowercase letters in the pattern, but if there are any uppercase letters in the pattern, the whole thing is case-sensitive. That's like (sometimes) ignoring case in the contents but not the pattern.

        – Wumpus Q. Wumbley
        yesterday











      • less is an interactive program quite unlike grep, not sure how it relates at all. interactive programs make usability choices, like nano where you can change case-sensitivity by hotkey. As for the manpage I think the old text actually explained it better, the new one does not make clear the pattern meaning itself changes too (even if [A-z] example is a bit constructed, the match result is completely different, so it should be in the manpage, but isn't anymore).

        – frostschutz
        16 hours ago
















      • 1





        "It ignores case in the file (contents) but also in the pattern", this suggests (although it doesn't necessarily say it), that it is possible to ignore case in the pattern, but not in the contents. I'd like to understand how this would work (ignoring pattern, but not contents -- or the other way around).

        – grep
        yesterday








      • 2





        In less, for example, there's a -i mode in which matching is case-insensitive if you only use lowercase letters in the pattern, but if there are any uppercase letters in the pattern, the whole thing is case-sensitive. That's like (sometimes) ignoring case in the contents but not the pattern.

        – Wumpus Q. Wumbley
        yesterday











      • less is an interactive program quite unlike grep, not sure how it relates at all. interactive programs make usability choices, like nano where you can change case-sensitivity by hotkey. As for the manpage I think the old text actually explained it better, the new one does not make clear the pattern meaning itself changes too (even if [A-z] example is a bit constructed, the match result is completely different, so it should be in the manpage, but isn't anymore).

        – frostschutz
        16 hours ago










      1




      1





      "It ignores case in the file (contents) but also in the pattern", this suggests (although it doesn't necessarily say it), that it is possible to ignore case in the pattern, but not in the contents. I'd like to understand how this would work (ignoring pattern, but not contents -- or the other way around).

      – grep
      yesterday







      "It ignores case in the file (contents) but also in the pattern", this suggests (although it doesn't necessarily say it), that it is possible to ignore case in the pattern, but not in the contents. I'd like to understand how this would work (ignoring pattern, but not contents -- or the other way around).

      – grep
      yesterday






      2




      2





      In less, for example, there's a -i mode in which matching is case-insensitive if you only use lowercase letters in the pattern, but if there are any uppercase letters in the pattern, the whole thing is case-sensitive. That's like (sometimes) ignoring case in the contents but not the pattern.

      – Wumpus Q. Wumbley
      yesterday





      In less, for example, there's a -i mode in which matching is case-insensitive if you only use lowercase letters in the pattern, but if there are any uppercase letters in the pattern, the whole thing is case-sensitive. That's like (sometimes) ignoring case in the contents but not the pattern.

      – Wumpus Q. Wumbley
      yesterday













      less is an interactive program quite unlike grep, not sure how it relates at all. interactive programs make usability choices, like nano where you can change case-sensitivity by hotkey. As for the manpage I think the old text actually explained it better, the new one does not make clear the pattern meaning itself changes too (even if [A-z] example is a bit constructed, the match result is completely different, so it should be in the manpage, but isn't anymore).

      – frostschutz
      16 hours ago







      less is an interactive program quite unlike grep, not sure how it relates at all. interactive programs make usability choices, like nano where you can change case-sensitivity by hotkey. As for the manpage I think the old text actually explained it better, the new one does not make clear the pattern meaning itself changes too (even if [A-z] example is a bit constructed, the match result is completely different, so it should be in the manpage, but isn't anymore).

      – frostschutz
      16 hours ago













      6















      "It ignores case in the file (contents) but also in the pattern",
      this suggests (although it doesn't necessarily say it),
      that it is possible to ignore case in the pattern, but not in the contents. 
      I'd like to understand how this would work
      (ignoring pattern, but not contents -- or the other way around).




      Well, for example, it could be written
      so that a pattern of “hello” would match “Hello” in the file,
      but not vice versa. 
      While this sounds hypothetical, it is the way spell-check works. 
      If your dictionary contains “stack” and “exchange”,
      and your document contains “Stack Exchange”,
      spell-check will succeed without error. 
      But if your dictionary contains “Unix” and your document contains “unix”,
      that will be flagged as an error.






      share|improve this answer




























        6















        "It ignores case in the file (contents) but also in the pattern",
        this suggests (although it doesn't necessarily say it),
        that it is possible to ignore case in the pattern, but not in the contents. 
        I'd like to understand how this would work
        (ignoring pattern, but not contents -- or the other way around).




        Well, for example, it could be written
        so that a pattern of “hello” would match “Hello” in the file,
        but not vice versa. 
        While this sounds hypothetical, it is the way spell-check works. 
        If your dictionary contains “stack” and “exchange”,
        and your document contains “Stack Exchange”,
        spell-check will succeed without error. 
        But if your dictionary contains “Unix” and your document contains “unix”,
        that will be flagged as an error.






        share|improve this answer


























          6












          6








          6








          "It ignores case in the file (contents) but also in the pattern",
          this suggests (although it doesn't necessarily say it),
          that it is possible to ignore case in the pattern, but not in the contents. 
          I'd like to understand how this would work
          (ignoring pattern, but not contents -- or the other way around).




          Well, for example, it could be written
          so that a pattern of “hello” would match “Hello” in the file,
          but not vice versa. 
          While this sounds hypothetical, it is the way spell-check works. 
          If your dictionary contains “stack” and “exchange”,
          and your document contains “Stack Exchange”,
          spell-check will succeed without error. 
          But if your dictionary contains “Unix” and your document contains “unix”,
          that will be flagged as an error.






          share|improve this answer














          "It ignores case in the file (contents) but also in the pattern",
          this suggests (although it doesn't necessarily say it),
          that it is possible to ignore case in the pattern, but not in the contents. 
          I'd like to understand how this would work
          (ignoring pattern, but not contents -- or the other way around).




          Well, for example, it could be written
          so that a pattern of “hello” would match “Hello” in the file,
          but not vice versa. 
          While this sounds hypothetical, it is the way spell-check works. 
          If your dictionary contains “stack” and “exchange”,
          and your document contains “Stack Exchange”,
          spell-check will succeed without error. 
          But if your dictionary contains “Unix” and your document contains “unix”,
          that will be flagged as an error.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered yesterday









          G-ManG-Man

          13.8k93870




          13.8k93870























              6














              Using the -i flag ignores the case of the matches, not the case of the filenames. You created a file whose name is all uppercase, but you told grep to open a file whose name is lowercase, leading to the "file not found" error message. Linux filenames are case-sensitive.






              share|improve this answer




























                6














                Using the -i flag ignores the case of the matches, not the case of the filenames. You created a file whose name is all uppercase, but you told grep to open a file whose name is lowercase, leading to the "file not found" error message. Linux filenames are case-sensitive.






                share|improve this answer


























                  6












                  6








                  6







                  Using the -i flag ignores the case of the matches, not the case of the filenames. You created a file whose name is all uppercase, but you told grep to open a file whose name is lowercase, leading to the "file not found" error message. Linux filenames are case-sensitive.






                  share|improve this answer













                  Using the -i flag ignores the case of the matches, not the case of the filenames. You created a file whose name is all uppercase, but you told grep to open a file whose name is lowercase, leading to the "file not found" error message. Linux filenames are case-sensitive.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 14 hours ago









                  stolenmomentstolenmoment

                  1823




                  1823






















                      grep is a new contributor. Be nice, and check out our Code of Conduct.










                      draft saved

                      draft discarded


















                      grep is a new contributor. Be nice, and check out our Code of Conduct.













                      grep is a new contributor. Be nice, and check out our Code of Conduct.












                      grep is a new contributor. Be nice, and check out our Code of Conduct.
















                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f513108%2fis-grep-documentation-about-ignoring-case-wrong-since-it-doesnt-ignore-case-in%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Cannot install PyQt5 The Next CEO of Stack OverflowCannot install tcpreplay 3.4.4cannot...

                      Kapp-Putsch Acontecimentos | Outros artigos | Menu de navegação

                      Why did early computer designers eschew integers? The Next CEO of Stack OverflowWhat register...