|
|
|
|
||||||
| comp.unix.shell Using and programming the Unix shell. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi,
I have a file that contains two lines of text: small line LARGE LINE Let's call this file "test". When I grep this file for "a", I get, as expected: $ grep a test small line When I grep this file for "A", I get, as expected: $ grep A test LARGE LINE Now, if I grep this file for [a-z], I get: $ grep [a-z] test small line LARGE LINE Now, _that_ is unexpected! Why on earth does grep return also the line with only capital letters when the expression to search is "[a-z]"?! Let me add that my environment variable GREP_OPTIONS is not set. Any idea? -- dave |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
dave_140390@hotmail.com wrote:
> Now, if I grep this file for [a-z], I get: > $ grep [a-z] test > small line > LARGE LINE Try this: $ grep '[[:lower:]]' test and this: $ LC_ALL=C grep '[a-z]' test -- All the commands are tested with bash and GNU tools, so they may use nonstandard features. I try to mention when something is nonstandard (if I'm aware of that), but I may miss something. Corrections are welcome. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
dave_140390@hotmail.com writes:
> Now, if I grep this file for [a-z], I get: > $ grep [a-z] test > small line > LARGE LINE > > Now, _that_ is unexpected! try echo grep [a-z] test to see what grep REALLY gets as input. (Remember, the shell parses meta-characters before grep seel them). |
|
![]() |
| Outils de la discussion | |
|
|