[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: documentation bug re character range expressions
From: |
Greg Wooledge |
Subject: |
Re: documentation bug re character range expressions |
Date: |
Fri, 3 Jun 2011 08:09:05 -0400 |
User-agent: |
Mutt/1.4.2.3i |
Oh, look, there's more!
On Fri, Jun 03, 2011 at 12:06:32AM -0700, Marcel (Felix) Giannelia wrote:
> [[:alpha:]] is too difficult to type to make it useful for the kind of
> quick pattern-matching that character ranges are used for on the
> interactive shell. Try it. Open-bracket, colon is an awkward sequence
> compared to something like "[a-z]".
Then do an export LC_COLLATE=C in your dot file of choice. Problem
solved.
> Bash is the *only* thing I know of that treats
> character ranges this way
You are SO incredibly wrong!
imadev:~$ uname -sr
HP-UX B.10.20
imadev:~$ locale
LANG=en_US.iso88591
LC_CTYPE="en_US.iso88591"
LC_COLLATE="en_US.iso88591"
LC_MONETARY="en_US.iso88591"
LC_NUMERIC="en_US.iso88591"
LC_TIME=POSIX
LC_MESSAGES="en_US.iso88591"
LC_ALL=
imadev:~$ echo Hello World | tr A-Z a-z
hÉMMÓ wÓSMÐ
imadev:~$ mkdir qwerty && cd qwerty
imadev:~/qwerty$ touch a B c D e F g
imadev:~/qwerty$ ls
a B c D e F g
imadev:~/qwerty$ LC_COLLATE=C ls
B D F a c e g
See? Both tr(1) and ls(1) do it too!
> Even grep, whose man page says it obeys LC_COLLATE and the locale,
> actually has [a-c] equivalent to [abc] on all locales. Someone must have
> snuck in and fixed it.
You must live in a strange and peculiar world.
imadev:~/qwerty$ type grep
grep is hashed (/usr/bin/grep)
imadev:~/qwerty$ echo 'brown cow' | grep '[A-C]'
brown cow
imadev:~/qwerty$ echo 'BROWN COW' | grep '[a-c]'
BROWN COW
Is every single bit of your knowledge born out of familiarity with just
ONE operating system with weird extensions?
You ought to report the bug in your vendor's grep(1) implementation, if
it is actually broken as you describe.
Message not available
Re: documentation bug re character range expressions, Chet Ramey, 2011/06/07