Sponsored Content
Full Discussion: thousands separator
Top Forums Shell Programming and Scripting thousands separator Post 302166550 by radoulov on Tuesday 12th of February 2008 06:26:47 AM
Old 02-12-2008
I suppose it's version/environment specific.

A User's Guide for GNU Awk
Edition 3
June, 2004

Quote:
' A single quote or apostrohe character is a POSIX extension to ISO C. It indicates
that the integer part of a floating point value, or the entire part of an
integer decimal value, should have a thousands-separator character in it. This
only works in locales that support such characters. For example:
$ cat thousands.awk # Show source program
a BEGIN { printf "%'d\n", 1234567 }
$ LC_ALL=C gawk -f thousands.awk # Run it in "C" locale
a 1234567
$ LC_ALL=en_US.UTF-8 gawk -f thousands.awk # Run in US English
UTF locale
a 1,234,567
 

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Multiple (thousands) of Cron Instances

Hey all, I have a box running SUSE SLES 8 and in the past few months the box will randomly spawn thousands of instances of /USR/SBIN/CRON to the point where the box will lock up entirely. Upwards of 14000 instances! I imagine it's using up all of the available files that can be opened at one... (10 Replies)
Discussion started by: sysera
10 Replies

2. Shell Programming and Scripting

Finding a specific pattern from thousands of files ????

Hi All, I want to find a specific pattern from approximately 400000 files on solaris platform. Its very heavy for me to grep that pattern to each file individually. Can anybody suggest me some way to search for specific pattern (alpha numeric) from these forty thousand files. Please note that... (6 Replies)
Discussion started by: aarora_98
6 Replies

3. Solaris

script for Gzip thousands of file

Hi experts, I have thousands of file (data file and Gziped file) in same directory like below-- bash-2.05$ pwd /home/mmc bash-2.05$ file PP023149200709270546 TT023149200709270546: gzip compressed data - deflate method bash-2.05$ file PP027443200711242320 TT027443200711242320: ... (10 Replies)
Discussion started by: thepurple
10 Replies

4. UNIX for Advanced & Expert Users

Copying Thousands of Tiny or Empty Files?

There is a procedure I do here at work where I have to synchronize file systems. The source file system always has three or four directories of hundreds of thousands of tiny (1k or smaller) or empty files. Whenever my rsync command reaches these directories, I'm waiting for hours for those files... (3 Replies)
Discussion started by: deckard
3 Replies

5. UNIX for Dummies Questions & Answers

How to truncate thousands of file names

Folder of e-mails in maildir format had been corrupted. Typical file name is 1246281161.6777.m21JH:2,S . The " :2,S prevents " copying to another device. How can I simply remove the last four characters? (2 Replies)
Discussion started by: steve900
2 Replies

6. Shell Programming and Scripting

help to parallelize work on thousands of files

I need to find a smarter way to process about 60,000 files in a single directory. Every night a script runs on each file generating a output on another directory; this used to take 5 hours, but as the data grows it is taking 7 hours. The files are of different sizes, but there are 16 cores... (10 Replies)
Discussion started by: vhope07
10 Replies

7. Shell Programming and Scripting

Search for patterns in thousands of files

Hi All, I want to search for a certain string in thousands of files and these files are distributed over different directories created daily. For that I created a small script in bash but while running it I am getting the below error: /ms.sh: xrealloc: subst.c:5173: cannot allocate... (17 Replies)
Discussion started by: danish0909
17 Replies

8. Shell Programming and Scripting

Bash-awk to process thousands of files

Hi to all, I have thousand of files in a folder with names with format "FILE-YYYY-MM-DD-HHMM" for what I want to send the following AWK command awk '/Code.*/' FILE-2014* I'd like to separate all files that have the same date to a folder named with the corresponding date. For example, if I... (7 Replies)
Discussion started by: Ophiuchus
7 Replies
SETLOCALE(3)						     Linux Programmer's Manual						      SETLOCALE(3)

NAME
setlocale - set the current locale. SYNOPSIS
#include <locale.h> char *setlocale(int category, const char *locale); DESCRIPTION
The setlocale() function is used to set or query the program's current locale. If locale is not NULL, the program's current locale is modified according to the arguments. The argument category determines which parts of the program's current locale should be modified. LC_ALL for all of the locale. LC_COLLATE for regular expression matching (it determines the meaning of range expressions and equivalence classes) and string collation. LC_CTYPE for regular expression matching, character classification, conversion, case-sensitive comparison, and wide character functions. LC_MESSAGES for localizable natural-language messages. LC_MONETARY for monetary formatting. LC_NUMERIC for number formatting (such as the decimal point and the thousands separator). LC_TIME for time and date formatting. The argument locale is a pointer to a character string containing the required setting of category. Such a string is either a well-known constant like "C" or "da_DK" (see below), or an opaque string that was returned by another call of setlocale. If locale is "", each part of the locale that should be modified is set according to the environment variables. The details are implementa- tion dependent. For glibc, first (regardless of category), the environment variable LC_ALL is inspected, next the environment variable with the same name as the category (LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, LC_TIME) and finally the environment vari- able LANG. The first existing environment variable is used. If its value is not a valid locale specification, the locale is unchanged, and setlocale returns NULL. The locale "C" or "POSIX" is a portable locale; its LC_CTYPE part corresponds to the 7-bit ASCII character set. A locale name is typically of the form language[_territory][.codeset][@modifier], where language is an ISO 639 language code, territory is an ISO 3166 country code, and codeset is a character set or encoding identifier like ISO-8859-1 or UTF-8. For a list of all supported locales, try "locale -a", cf. locale(1). If locale is NULL, the current locale is only queried, not modified. On startup of the main program, the portable "C" locale is selected as default. A program may be made portable to all locales by calling setlocale(LC_ALL, "" ) after program initialization, by using the values returned from a localeconv() call for locale - dependent informa- tion, by using the multi-byte and wide character functions for text processing if MB_CUR_MAX > 1, and by using strcoll(), wcscoll() or strxfrm(), wcsxfrm() to compare strings. RETURN VALUE
A successful call to setlocale() returns an opaque string that corresponds to the locale set. This string may be allocated in static stor- age. The string returned is such that a subsequent call with that string and its associated category will restore that part of the process's locale. The return value is NULL if the request cannot be honored. CONFORMING TO
ANSI C, POSIX.1 NOTES
Linux (that is, GNU libc) supports the portable locales "C" and "POSIX". In the good old days there used to be support for the European Latin-1 "ISO-8859-1" locale (e.g. in libc-4.5.21 and libc-4.6.27), and the Russian "KOI-8" (more precisely, "koi-8r") locale (e.g. in libc-4.6.27), so that having an environment variable LC_CTYPE=ISO-8859-1 sufficed to make isprint() return the right answer. These days non-English speaking Europeans have to work a bit harder, and must install actual locale files. SEE ALSO
locale(1), localedef(1), strcoll(3), isalpha(3), localeconv(3), strftime(3), charsets(4), locale(7), nl_langinfo(3) GNU
1999-07-04 SETLOCALE(3)
All times are GMT -4. The time now is 10:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy