Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

locale(3pm) [osx man page]

locale(3pm)						 Perl Programmers Reference Guide					       locale(3pm)

NAME
locale - Perl pragma to use or avoid POSIX locales for built-in operations SYNOPSIS
@x = sort @y; # Unicode sorting order { use locale; @x = sort @y; # Locale-defined sorting order } @x = sort @y; # Unicode sorting order again DESCRIPTION
This pragma tells the compiler to enable (or disable) the use of POSIX locales for built-in operations (for example, LC_CTYPE for regular expressions, LC_COLLATE for string comparison, and LC_NUMERIC for number formatting). Each "use locale" or "no locale" affects statements to the end of the enclosing BLOCK. Starting in Perl 5.16, a hybrid mode for this pragma is available, use locale ':not_characters'; which enables only the portions of locales that don't affect the character set (that is, all except LC_COLLATE and LC_CTYPE). This is useful when mixing Unicode and locales, including UTF-8 locales. use locale ':not_characters'; use open ":locale"; # Convert I/O to/from Unicode use POSIX qw(locale_h); # Import the LC_ALL constant setlocale(LC_ALL, ""); # Required for the next statement # to take effect printf "%.2f ", 12345.67' # Locale-defined formatting @x = sort @y; # Unicode-defined sorting order. # (Note that you will get better # results using Unicode::Collate.) See perllocale for more detailed information on how Perl supports locales. perl v5.16.2 2012-10-11 locale(3pm)

Check Out this Related Man Page

LOCALE(1)						    BSD General Commands Manual 						 LOCALE(1)

NAME
locale -- display locale settings SYNOPSIS
locale [-a|m] locale [-ck] name [...] DESCRIPTION
locale displays information about the current locale, or a list of all available locales. When locale is run with no arguments, it will display the current source of each locale category. When locale is given the name of a category, it acts as if it had been given each keyword in that category. For each keyword it is given, the current value is displayed. OPTIONS
-a Lists all public locales. -c name ... Lists the category name before each keyword, unless it is the same category as the previously displayed keyword. -k name ... Displays the name of each keyword prior to its value. -m Lists all available public charmaps. Darwin locales do not support charmaps, so list all CODESETs instead. OPERANDS
The following operand is supported: name is the name of a keyword or category to display. A list of all keywords and categories can be shown with the following command: locale -ck LC_ALL ENVIRONMENT
LANG Used as a substitute for any unset LC_* variable. If LANG is unset, it will act as if set to "C". If any of LANG or LC_* are set to invalid values, locale acts as if they are all unset. LC_ALL Will override the setting of all other LC_* variables. LC_COLLATE Sets the locale for the LC_COLLATE category. LC_CTYPE Sets the locale for the LC_CTYPE category. LC_MESSAGES Sets the locale for the LC_MESSAGES category. LC_MONETARY Sets the locale for the LC_MONETARY category. LC_NUMERIC Sets the locale for the LC_NUMERIC category. LC_TIME Sets the locale for the LC_TIME category. SEE ALSO
localedef(1), localeconv(3), nl_langinfo(3), setlocale(3) STANDARDS
The locale utility conforms to IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
locale appeared in Mac OS X 10.4 Darwin August 27, 2004 Darwin
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Perl - Programmers manual online?

I have never programmed in Perl (insert laughter, mock, etc. here ____) - so I need a sort of "Programming in Perl" covering the basics. I now have two Perl books, one is a 5 volume Unix resource kit, the other is "Mastering algorithms with Perl" - none of them explains how to produce "hello,... (11 Replies)
Discussion started by: AtleRamsli
11 Replies

2. Shell Programming and Scripting

perl sorting

I have many files that I need to sort each week. I know how to do in Unix, but for this task it appears best to do native inside an existing perl program. So, simplified, I have a file similar to the following: Joe_________12_Main_St__A001________LX Benny_______5_Spring____A002________LX... (5 Replies)
Discussion started by: joeyg
5 Replies

3. UNIX for Dummies Questions & Answers

sorting data from who by IP

Hello. I have an RS/6000 running AIX 4 and I need to be able to see if there are any users that are logged on more than once from the same terminal so I can kick them off to make room for other terminals. 64 connections is the limit. Currently I am doing this: who | more and then manually... (11 Replies)
Discussion started by: raidzero
11 Replies

4. Shell Programming and Scripting

Need immediate help with sorting!!!

hey, I have a file that looks smthng like this: /*--- abcd_0050 ---*/ asdfjk adsfkja lkjljgafsd /*---abcd_0005 ---*/ lkjkljbfkgj ldfksjgf dfkgfjb /*-- abcd_0055--*/ klhfdghd dflkjgd jfdg I would like it to be sorted so that it looks like this: /*---abcd_0005 ---*/ lkjkljbfkgj (9 Replies)
Discussion started by: sasuke_uchiha
9 Replies

5. UNIX for Dummies Questions & Answers

Sorting Difficulties

Hey guys, I am sort of new to unix and I am having difficulty sorting. What I am trying to do is sort a particular field in reversed order and another field in alphabetic order to create a new file that looks like this: MILLER,EDWARD AL 14 101293 9341 MOORE,HENRY 15 ... (6 Replies)
Discussion started by: nthamma
6 Replies

6. UNIX for Dummies Questions & Answers

sorting doubt

HI, I would like to know if there if any sorting command which uniquifies the list but does not arrange in alphabetical order. ex- I have b b a b Output I want is : b a I am trying sort -u and this does the sorting in alphabetical order. Please help friends (5 Replies)
Discussion started by: abhishekarun123
5 Replies

7. Shell Programming and Scripting

perl sort unicode non-ascii letters

In another thread (field separator in Perl) I nearly solved my sorting problem and I finally understood the Schwartzian transform especially thank to KevinADC. After that I've found out that the sorting was not done the way I need it. I did not notice it at first because I used all vowels as a... (6 Replies)
Discussion started by: ahsog
6 Replies

8. Shell Programming and Scripting

perl sorting variables

Good morning!! Im trying to practice withe Perl and sorting variables is not going good at all! #!/usr/bin/perl $username = $ENV {'LOGNAME'}; print "Hello, $username\n"; I want to add sort and 'mail' and 'home'. This below is what I have came up with,but of course its not working. ... (5 Replies)
Discussion started by: bigben1220
5 Replies

9. UNIX for Dummies Questions & Answers

sorting numbers with sort -n

Looking for help for sort, I learned that for sorting numbers I use: sort -n but it seems that that is not enough when you have numbers like 0.2000E+7 for example, sort -n will not worry about the E+7 part, and will just sort the numbers like 0.2000. Exapmle: cat example.txt .91000E+07... (9 Replies)
Discussion started by: cosmologist
9 Replies

10. Shell Programming and Scripting

AWK/GREP sorting help

hi everyone, I am kind of new to this forum. I need help in sorting this data out accordingly, I am actually doing a traceroute application and wants my AS path displayed in front of my address like this; 192.168.1.1 AS28513 AS65534 AS5089 AS5089 .... till the last AS number and if possible sort... (8 Replies)
Discussion started by: sam127
8 Replies

11. Shell Programming and Scripting

Help needed in sorting

Hi, Please I need urgent help in sorting below data, I had similar post but there was a kind of space in between the data but now there is no space and I have tried adjusting the old script to work but it didn't. here are the data; traceroute to 2001:1ba0:2a0:5965:0:30:24:1... (6 Replies)
Discussion started by: sam127
6 Replies

12. UNIX for Dummies Questions & Answers

Does this statement of code mean.....

Good morning, I am 100% mew to Unix and am trying to troubleshoot why a pgm written 3 years ago, suddenly is not working properly. It is part Perl with some UNIX commands thrown in. I need to verify what the UNIX commands are doing before I can continue with my other troubleshooting. print... (7 Replies)
Discussion started by: jaacmmason
7 Replies

13. Solaris

What about sorting a 5G file?

Hi Guys, My client (dear clients, I hate to love you) has the funky idea of sorting a 5G flat file. Certainly enough, this is taking forever and also fulls the / of our machine. Any idea of how we could proceed to make this a little bit more efficient? Maybe by forcing sort to "stay in... (7 Replies)
Discussion started by: plmachiavel
7 Replies

14. Shell Programming and Scripting

Warning while sorting : A newline character was added to the end of file

Hi, I am trying to sort a csv file which has say 10 lines each line having a row size that is upto 30183 no. of COLUMNS (Row length = 30183). There is a LINE FEED (LF) at the end of each line. When I try to sort this file say, based on the second FIELD using the below command, sort -t ',' +1... (5 Replies)
Discussion started by: DHeisenberg
5 Replies

15. UNIX for Advanced & Expert Users

Russian character set issue.

Hi All, I'm facing issue while opening xls file while contains Russian/Siberian character I tried various options which I could get from google but still issue persists hence thought of taking help here, We are trying to export data from Oracle via shell script using sqlplus utility. After... (8 Replies)
Discussion started by: arvindshukla81
8 Replies