From owner-freebsd-questions@FreeBSD.ORG Tue Jan 31 14:27:37 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D10E6106566C for ; Tue, 31 Jan 2012 14:27:37 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id 9CECB8FC0A for ; Tue, 31 Jan 2012 14:27:37 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id q0VEVimC094105; Tue, 31 Jan 2012 08:31:44 -0600 (CST) Date: Tue, 31 Jan 2012 08:31:44 -0600 (CST) From: Robert Bonomi Message-Id: <201201311431.q0VEVimC094105@mail.r-bonomi.com> To: eam1edward@gmail.com, freebsd-questions@freebsd.org In-Reply-To: <4F27E270.7020001@gmail.com> Cc: Subject: Re: bash LC_COLLATE or LC_ALL set =?windows-1252?q?=93C=94_not__?= =?windows-1252?q?sort_in_dictionary_order=2E?= X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Jan 2012 14:27:37 -0000 > From owner-freebsd-questions@freebsd.org Tue Jan 31 05:45:47 2012 > Date: Tue, 31 Jan 2012 04:45:36 -0800 > From: Edward Martinez > To: FreeBSD Questions > Subject: bash LC_COLLATE or LC_ALL set =?windows-1252?q?=93C=94_not__sort?= > =?windows-1252?q?_in_dictionary_order=2E?= > > > > > Hi, > > Been trying to get BASH to sort set characters in dictionary order. > I typed "locale" and it shows LC_COLLATE and LC_ALL are set to "C" > thought that was enough to work, > however when i type metacharacters: set character; any character, > something like this: > > ls [a-cx-y]* > > bash does not sort in dictionary order; file "Binarc" does not > list. > *OF*COURSE* it doesn't. Unix is _case_sensitive_. You specified a lower- case only (in the C locale) pattern. Naturally, it doesn't match a file with an upper-case character in it. Note: in the 'C' locale, characters are sorted on the underlying byte value. Thus you will get all the upper-case matches before any lower-case match. To get upper-and-lower case files in the C locale, you will have to use: ls [A-CX-Ya-cx-y]* IF you speciy a different charset for collating, you _may_ get upper/lower case characters sorted adjacently. See the specifications for the charset in question.