I cannot get grep
to case sensitive search with this pattern
$ grep 'T[A-Z]' test.txt
The Quick Brown Fox Jumps Over The Lazy Dog
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
I cannot get grep
to case sensitive search with this pattern
$ grep 'T[A-Z]' test.txt
The Quick Brown Fox Jumps Over The Lazy Dog
THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG
Use quotes to prevent the pattern from being matched as a glob to file(s) in the filesystem by the shell.
''
Use a named character class to guarantee a case-sensitive match.
[[:lower:]]
Use a quantifier to make matches for more than one character.
\+
Use anchor(s) to make sure the match is positioned properly.
^
The reason that
[A-Z]
isn't working for you is that the way the locale you're using is implemented on your system, that pattern also includes lowercase letters.You can set LANG value: