LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] [TOTD] querying the locale database

[ILUG] [TOTD] querying the locale database

P at draigBrady.com P at draigBrady.com
Thu Sep 30 12:50:59 IST 2004


There is a very useful database of "country" specific
information, located on all linux systems.
For e.g. if one wants to lookup the international
telephone prefix for France, you do:

LANG=fr_FR locale int_prefix

I have found it difficult to interact with this
locale database though. In the above example
how does one know how to specify the record (fr_FR)
or to select the field (int_prefix). so...


To list the fields available, do:

locale | cut -d= -f1 | xargs locale -kc | less


To list the records (countries) available, do:

locale -a |
grep _ | #don't show nationalities
grep -Ev '[.@]' | #ignore diffent charmaps
while read lang; do
     echo -n "$lang "; LANG=$lang locale territory
done |
sort -k2

Pádraig.



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell