Re: how to list file and sort by filename using ls

2006-04-26 Thread Thomas Charron
 That's why the code gods created UTF-8. It's pretty much compatible with good old ASCII, unless, of course, there is suddenly an UTF-8 character that's NOT ascii. ;-)

 Thomas
On 4/24/06, Ben Scott [EMAIL PROTECTED] wrote:
On 4/24/06, Paul Lussier [EMAIL PROTECTED] wrote:
 No matter how many man pages you read, or web sites you click on resulting from googling this porblme, the only thing which will help is setting LANG=C the way KR meant things to be.Heh.I sympathize.I too pine for the days when everything was
ASCII and characters could fit into a 7-bit byte and things weresimple.Those days are rapidly passing.There are billions of peoplein the world whose language won't fit nicely into ASCII, and they wantto use the Internet, too.
We live in interesting times.-- Ben___gnhlug-discuss mailing listgnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: how to list file and sort by filename using ls

2006-04-25 Thread Paul Lussier
Ben Scott [EMAIL PROTECTED] writes:

 On 4/24/06, Paul Lussier [EMAIL PROTECTED] wrote:
 No matter how many man pages you read, or web sites you click on
 resulting from googling this porblme, the only thing which will help
 is setting LANG=C the way KR meant things to be.

 There are billions of people in the world whose language won't fit
 nicely into ASCII, and they want to use the Internet, too.

And they should all learn a languge that fits nicely into 7 bits ;)
-- 

Seeya,
Paul 

(for those who wish to be offended by this, feel free to be so.  It is
however, your choice, since this is meant entirely tongue-in-cheek.
See the ;) above! :)
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: how to list file and sort by filename using ls

2006-04-25 Thread Paul Lussier
mike ledoux [EMAIL PROTECTED] writes:

 On Mon, Apr 24, 2006 at 09:12:44PM -0400, Ben Scott wrote:
   Heh.  I sympathize.  I too pine for the days when everything was
 ASCII and characters could fit into a 7-bit byte and things were
 simple.  Those days are rapidly passing.  There are billions of people
 in the world whose language won't fit nicely into ASCII, and they want
 to use the Internet, too.

 Tough.  Damned hippies should get their own fscking internet.

And define a byte to be the appropriate size so their character set fits!
-- 

Seeya,
Paul
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: how to list file and sort by filename using ls

2006-04-25 Thread Steven W. Orr
On Monday, Apr 24th 2006 at 16:33 -0400, quoth Zhao Peng:

=output of echo $LANG:
=
=   en_US.UTF-8
=
=LANG=C ls -ul does do what I expected to do.
=
=What does C mean? character?
=
=Thank you,  Kevin.
=
=Zhao
=
= 1:  can you show us the output of the following:
= 
= echo $LANG
= 
= 2:  Does this do what you want?:
= 
= LANG=C ls -ul
= 
= 
= I'll bet that the output of ls is sorted, but just not in the order
= that you expected.
= 
= Regards,

I don't know what distro you're using but under redhat/fedora flavored 
systems, you can change the LANG stuff system wide in /etc/sysconfig/i18n

My copy looks like this:

539  cat /etc/sysconfig/i18n 
#LANG=en_US.UTF-8
LANG=C
SYSFONT=latarcyrheb-sun16
SUPPORTED=en_US.UTF-8:en_US:en
LC_COLLATE=C


-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


how to list file and sort by filename using ls

2006-04-24 Thread Zhao Peng

Now I should say good afternoon :)

Using either ls -ul or ls -cl(which are supposed to sort by name 
according to manual, if I understood and used correctly), I just can't 
list files and sort them by filenames.


Google results of key word sort by name linux ls is pretty much the 
same as man ls, not helpful.


OS: Redhat Enterprise.

Any clue? Thanks,

Zhao

P.S.sorry if this sounds UNbelievably naive/stupid. :)
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: how to list file and sort by filename using ls

2006-04-24 Thread Jerry Feldman
On Monday 24 April 2006 3:46 pm, Zhao Peng wrote:
 Now I should say good afternoon :)

 Using either ls -ul or ls -cl(which are supposed to sort by name
 according to manual, if I understood and used correctly), I just can't
 list files and sort them by filenames.

 Google results of key word sort by name linux ls is pretty much the
 same as man ls, not helpful.

 OS: Redhat Enterprise.
Try info ls
GNU likes to live up to it's GNU is Not Unix.
Here is a section that should give you what you want. 
An excerpt:
10.1.3 Sorting the output
-

These options change the order in which `ls' sorts the information it
outputs.  By default, sorting is done by character code (e.g., ASCII
order).


-- 
Jerry Feldman [EMAIL PROTECTED]
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: how to list file and sort by filename using ls

2006-04-24 Thread Jerry Feldman
On Monday 24 April 2006 3:46 pm, Zhao Peng wrote:
 Now I should say good afternoon :)

 Using either ls -ul or ls -cl(which are supposed to sort by name
 according to manual, if I understood and used correctly), I just can't
 list files and sort them by filenames.
I forgot to mention that the Locale settings affect the sort order also. 
-- 
Jerry Feldman [EMAIL PROTECTED]
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: how to list file and sort by filename using ls

2006-04-24 Thread Kevin D. Clark

Zhao Peng writes:

 Using either ls -ul or ls -cl(which are supposed to sort by name
 according to manual, if I understood and used correctly), I just can't
 list files and sort them by filenames.

1:  can you show us the output of the following:

echo $LANG

2:  Does this do what you want?:

LANG=C ls -ul


I'll bet that the output of ls is sorted, but just not in the order
that you expected.

Regards,

--kevin
-- 
GnuPG ID: B280F24E And the madness of the crowd
alumni.unh.edu!kdc Is an epileptic fit
   -- Tom Waits

___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


how to list file and sort by filename using ls

2006-04-24 Thread Zhao Peng

output of echo $LANG:

   en_US.UTF-8

LANG=C ls -ul does do what I expected to do.

What does C mean? character?

Thank you,  Kevin.

Zhao


1:  can you show us the output of the following:

echo $LANG

2:  Does this do what you want?:

LANG=C ls -ul


I'll bet that the output of ls is sorted, but just not in the order
that you expected.

Regards,


___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: how to list file and sort by filename using ls

2006-04-24 Thread Ben Scott
On 4/24/06, Zhao Peng [EMAIL PROTECTED] wrote:
 output of echo $LANG:

 en_US.UTF-8

 LANG=C ls -ul does do what I expected to do.

 What does C mean? character?

  C means C, as in the C programming language.  When you say
LANG=C, you tell the system you want the old-fashioned sort order
based on encoded character values (typically ASCII) that C always
used.  With LANG=C, the system isn't locale or language aware, and
just does a simple numeric comparison of characters.  This means, for
example, that capital letters sort before lowercase letters.  This
tends to fail miserably with non-Latin character sets (i.e., not US or
Western Europe).

  With LANG=en_US.UTF-8, the system is being told two things.  One,
the sort order should be as proper for the English language in the US.
 (That means case-insensitive sorts and such.)  Second, character
encoding should be assumed to be UTF-8.  UTF-8 is a method of encoding
Unicode characters which is backwards-compatible with ASCII.  Anything
which is legal ASCII encodes to the same value in UTF-8; higher order
characters (which are never legal in ASCII) get encoded using multiple
bytes (varying lengths, depending on the Unicode character).

-- Ben

___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: how to list file and sort by filename using ls

2006-04-24 Thread Jerry Feldman
On Monday 24 April 2006 4:33 pm, Zhao Peng wrote:
 output of echo $LANG:

 en_US.UTF-8

 LANG=C ls -ul does do what I expected to do.

 What does C mean? character?
This is the C locale. It will change the sort order.

-- 
Jerry Feldman [EMAIL PROTECTED]
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: how to list file and sort by filename using ls

2006-04-24 Thread Kevin D. Clark

Zhao Peng [EMAIL PROTECTED] writes:

 output of echo $LANG:

 en_US.UTF-8

 LANG=C ls -ul does do what I expected to do.

 What does C mean? character?

To be more specific, I probably should have specified LC_COLLATE
instead of LANG.  No big deal.

All of this stuff refers to locale settings, which all relates to
internationalization (which is frequently abbrebiated I18N).

I think that this web page gives a good description of what UTF-8 is:

   http://docs.sun.com/app/docs/doc/805-4123/6j3tmpc75?a=view

   UTF-8 is a file system safe Universal Character Set Transformation
   Format of Unicode / ISO/IEC 10646-1 formulated by XoJIG of X/Open
   in 1992 and approved by ISO and IEC as Amendment 2 to ISO/IEC
   10646-1:1993 in 1996.

This is a far more precise description of what UTF-8 is than I can
conjure up at this time of day.  (-:

So, part of the notion of a locale is a *character set*, and
furthermore, there is an associated way to *collate/sort* these
characters as well.

en_US.UTF-8 sees 'a' and 'A' as being equivalent when these are
sorted.

When LANG=C, your telling the system that you want the {old, default,
non-I18N, characters are functionally at most 1*sizeof(char) wide,
this is how the C language originally did it} manner of
sorting/collating.  In this locale, 'a' and A are different.

Many people, including myself, are more used to the C locale's way
of sorting, but we can see the merits of other locales too.

You can learn more by reading the man pages for locale, setlocale(),
strcoll(), etc.

Regards,

--kevin
-- 
GnuPG ID: B280F24E And the madness of the crowd
alumni.unh.edu!kdc Is an epileptic fit
   -- Tom Waits

___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: how to list file and sort by filename using ls

2006-04-24 Thread Paul Lussier
Zhao Peng [EMAIL PROTECTED] writes:

 Now I should say good afternoon :)

 Using either ls -ul or ls -cl(which are supposed to sort by name
 according to manual, if I understood and used correctly), I just can't
 list files and sort them by filenames.

Others have mentioned the values of various environment variables,
which is usualy my second place to look, the first being the man page
:)

  DESCRIPTION
 List information about the FILEs (the current directory by
 default).  Sort entries alphabetically if none of -cftuSUX
 nor --sort.

The DESCRIPTION clearly states that the default behavior is to sort
listings alphabetically.  *Furthermore*, it implies that and of
-cftuSUX or --sort *ALTER* the default output.

So, what do -c and -u do?

   -c with -lt: sort by, and show, ctime (time of last modification of
  file status information) with -l: show ctime and  sort  by  name
  otherwise: sort by ctime

   -u with  -lt:  sort  by, and show, access time with -l: show access
  time and sort by name otherwise: sort by access time

So, there you have it, -c and -u, when used with -l do more than just
sort by name.  -c sorts by ctime, -u sorts by name, then access time.

hth.

-- 

Seeya,
Paul
___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss


Re: how to list file and sort by filename using ls

2006-04-24 Thread Ben Scott
On 4/24/06, Paul Lussier [EMAIL PROTECTED] wrote:
 No matter how many man pages you read, or web sites you click on
 resulting from googling this porblme, the only thing which will help
 is setting LANG=C the way KR meant things to be.

  Heh.  I sympathize.  I too pine for the days when everything was
ASCII and characters could fit into a 7-bit byte and things were
simple.  Those days are rapidly passing.  There are billions of people
in the world whose language won't fit nicely into ASCII, and they want
to use the Internet, too.

  We live in interesting times.

-- Ben

___
gnhlug-discuss mailing list
gnhlug-discuss@mail.gnhlug.org
http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss