From owner-freebsd-questions@FreeBSD.ORG Tue Jan 31 19:01:22 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 90EC01065676 for ; Tue, 31 Jan 2012 19:01:22 +0000 (UTC) (envelope-from eam1edward@gmail.com) Received: from mail-pw0-f54.google.com (mail-pw0-f54.google.com [209.85.160.54]) by mx1.freebsd.org (Postfix) with ESMTP id 639478FC19 for ; Tue, 31 Jan 2012 19:01:22 +0000 (UTC) Received: by pbdv10 with SMTP id v10so518553pbd.13 for ; Tue, 31 Jan 2012 11:01:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=53aXRNMtl9bYYyCa/nMLS1v6Mm1zZqVK21cRUlBQEzo=; b=kCSzEa5MsXCHty8EfeLWwmr7G9DaWEvLpxkUCnazoc7Avdz4HTctm2kNTg+9XqLXBq STtl9D89tdomeJ5OE2d/njQLbAHYotfF9FRP68gMl/F9cvYWwJohoLL+Bq9nVrRiolKK gakycR9CuFISS2OPt4DAvDvomhoxvSs4i0G2Q= Received: by 10.68.118.136 with SMTP id km8mr53069363pbb.73.1328036481933; Tue, 31 Jan 2012 11:01:21 -0800 (PST) Received: from [192.168.1.101] ([174.134.109.226]) by mx.google.com with ESMTPS id k9sm57417670pbl.18.2012.01.31.11.01.20 (version=SSLv3 cipher=OTHER); Tue, 31 Jan 2012 11:01:21 -0800 (PST) Message-ID: <4F2849A5.5070504@gmail.com> Date: Tue, 31 Jan 2012 12:05:57 -0800 From: Edward Martinez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 To: Robert Bonomi References: <201201311431.q0VEVimC094105@mail.r-bonomi.com> In-Reply-To: <201201311431.q0VEVimC094105@mail.r-bonomi.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-questions@freebsd.org 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 19:01:22 -0000 On 01/31/12 06:31, Robert Bonomi wrote: >> 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. > > Thanks for reply! I meant LC_COLLATE being set to en_US.UTF-8 not C. linux and solaris shows both upper and lowercase when set characters like [a-cx-y] and others are used. when LC_COLLATE is set to en_US.UTF-8. I thought it could be also done in FreeBSD's bash when LC_COLLATE is set to en_US.UTF-8 in linux LC_COLLATE is set to en_US,UTF-8 eam@localhost ~/testdir $ locale LANG= LC_CTYPE="POSIX" LC_NUMERIC="POSIX" LC_TIME="POSIX" *LC_COLLATE=en_US.UTF-8* LC_MONETARY="POSIX" LC_MESSAGES="POSIX" LC_PAPER="POSIX" LC_NAME="POSIX" LC_ADDRESS="POSIX" LC_TELEPHONE="POSIX" LC_MEASUREMENT="POSIX" LC_IDENTIFICATION="POSIX" LC_ALL= And when i type the following it shows both: eam@localhost ~/testdir $ ls [a-cx-y]* bincar Bincar eam@localhost ~/testdir $ ls [a-z]* bincar Bincar file File zcar