[lug] grep question
Jeffrey Haemer
jeffrey.haemer at gmail.com
Tue Jun 12 20:25:32 MDT 2007
Steve,
Very nice. Try this, too. (Output's from Ubuntu Feisty Fawn. YMMV.)
echo $LANG # default value
en_US.UTF-8
mkdir /tmp/foo; cd /tmp/foo # scratch directory
touch a b A B # with four empty files
ls # ls lists in collating order
a A b B
LANG=C ls # use traditional Unix ASCII collation
A B a b
LANG=POSIX ls # ditto
A B a b
LC_COLLATE=C ls # setting LC_COLLATE alone also works
A B a b
LC_COLLATE=$LANG LANG=C ls # in fact, LC_COLLATE trumps LANG
a A b B
ls # just to verify that nothing's changed
a A b B
(I'm using the old trick that "VAR=foo command" changes the value of VAR for
the child process without changing it in the current shell.)
You can try out other character sets (mine are in /usr/share/i18n/locales)
or LC_ variables to play around to your heart's content. For example, on my
distro, I see
LANG=en_CA.UTF-8 ls # Canadians are backwards, eh?
A a B b
I've used some fonting in the examples, above, to make them look pretty in
gmail. If it doesn't come through properly for you, my apologies; complain
directly to me and I'll send you something more conventional.
--
Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell]
http://goyishekop.blogspot.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20070612/e3a98701/attachment.html>
More information about the LUG
mailing list