bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Whats wrong with 'sets in grep'


From: Matthew Woehlke
Subject: Re: Whats wrong with 'sets in grep'
Date: Tue, 19 Dec 2006 18:17:16 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.0

SPS Khokhar wrote:
Kindly someone explain to me, what is wrong with 'sets in grep'

following are two commands logically seems same but results are like
north-south pole, not same.

what i want is - All files/dir having names in uppercases only

------------------------------------------------
[simrat > simrat]$ ls | grep ^[A-Z]*$
crbt
Desktop
evolution
ice
just
Linux
misc
MYSHARE
scripting
send
test
zBochs

[simrat > simrat]$ ls | grep ^[ABCDEFGHIJKLMNOPQRSTUVWXYZ]*$
MYSHARE
----------------------------------------------------

You mean, aside from that you should be using '[:upper:]'? Did you read the man page? Particularly the part about locale, and how "many locales sort characters in dictionary order, and in these locales ([A-D]) is typically not equivalent to ([ABCD]); it might be equivalent to ([AbBcDdD]), for example" (quote edited to match the behavior you seem to be seeing)? And how "you can use the C locale by setting the LC_ALL environment variable to the value C"?

--
Matthew
This message is non-smoking





reply via email to

[Prev in Thread] Current Thread [Next in Thread]