bug-fileutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fileutils - contribution - digit delineation in number output (735,666,9


From: matt andrew
Subject: fileutils - contribution - digit delineation in number output (735,666,912)
Date: Tue, 9 Jul 2002 15:43:36 -0700 (PDT)

from address@hidden:
> I suspect the delimiter would be determined by the locale. Some
> countries use a dot, some a comma and some an apostrophe, I
> believe.

and from address@hidden:
> It looks like strfmon(7) was made just for this ; according to locale(7) :
> ...
> I'm guessing that with (LC_ALL set to the proper value) strfmon will format
numbers nicely.

Using the locale is a good idea.  There's a problem (on my distro anyway). 
RedHat 7.1 "en_US" locale.  By default, it came installed with the default "C"
locale.  This (I did a test) uses a '.' as a decimal point, but has nothing set
up as the thousands separator.  Accroding to the notes in the setlocale() man
page, there are usually only the "C" and "POSIX" locales installed.  So using
locale won't accomplish what I want for most people.  d'oh!  That would have
simplified the interface to these delimitation options.
sidenote:  using setlocale(LC_ALL, "POSIX") seemed not to do anything, meaning
that after the aforementioned call, setlocale(LC_ALL, NULL) still returns "C" 
Any hints on this are welcome.
another sidenote:  I could fudge some locales or suggest the install of some
locale that would do the job.  But I doubt that many people would delve into
the man pages of the fileutils enough to learn that they can have delimited
numbers in their outputs if only they'd install a locale - and most that did
know it was possible just wouldn't.  Could be wrong on that though...

from address@hidden:
> Also, rather than having multiple options to set the delimiter,
> why not just have a --delimiter=<whatever> option, to allow
> arbitrary text?

I'm happy to include that functionality, but I still wanna keep --comma-delimit
(etc) too.

Does anyone think there's any (non-contrived) use for a multi-character
delimitation? (ie something other than 123gort456gort789 for 123456789)

So in the newer, more complete, nearly finished version, I think I'm gonna keep
the --comma-delimit, --dot-delimit, --space-delimit as well as the
--delimiter=<whatever> thing that you (Richard Dawe) suggested.


=====
-Matt Andrew

__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]