Sponsored Content
Full Discussion: formatted output with commas
Top Forums Shell Programming and Scripting formatted output with commas Post 302171742 by Tytalus on Friday 29th of February 2008 10:16:07 AM
Old 02-29-2008
sed to add commas in to numbers:

Code:
 echo 1234567 | sed -e :a -e 's/\([0-9][0-9]*\)\([0-9][0-9][0-9]\)/\1,\2/;ta'

HTH
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Formatted output in KSH

Hi, Is there some way to get formatted output in ksh? Something like a properly alligned tabular format. I tried adding '\t' to echo statements, but it doesn't come properly alligned 'hello' A simple Hello 'helloworld' A helloworld statement I need the second coloumn to... (1 Reply)
Discussion started by: psynaps3
1 Replies

2. Shell Programming and Scripting

Formatted output - awk

Hi I have the following records in a file SABN YOURTUBE 000514 7256 SACN XYOUDSDF 000514 7356 SADN KEHLHRSER 000514 7656 SAEN YOURTUBE 000514 7156 SAFN YOURTUBE 000514 7056 I need to put this in the format like this printf '%s %-50s %6s %-6s\n' I am not going to read individual... (3 Replies)
Discussion started by: dhanamurthy
3 Replies

3. Shell Programming and Scripting

Formatted Output

Hi I have the following lines in a file SWPRC000001NOT STATED 1344 SWPRC000001NOT STATED 1362 SWPRC000001NOT STATED 1418 SWPRC000001NOT STATED 1436 SWPRC000001NOT STATED ... (6 Replies)
Discussion started by: dhanamurthy
6 Replies

4. Shell Programming and Scripting

cut - columns with formatted Output

Hi I have the input file as below ***TEST10067 00567GROSZ 099 00567CTCTSDS90 ***TEST20081 08233GROZWEWE 00782GWERW899 ***TEST30088 08233GROZWEWE 00782GWERW899 I am finding the lines starting with *** and outputing as below TEST10067 TEST20081 TEST30088 I need a space between TEST1... (9 Replies)
Discussion started by: dhanamurthy
9 Replies

5. Shell Programming and Scripting

Formatted output of shell script

Hello, I am working on one script which is giving output as a pipe "|" separated abcd | efgh | 20090745 abcdefgh | efg | 20090622 Can any one please help me i want it to be formatted as pipe will be aligned, or the output looks like a table. (2 Replies)
Discussion started by: vikash_k
2 Replies

6. Shell Programming and Scripting

output - tab formatted - awk

Dear All, Good Day. I would like to hear your suggestions for the following problem: I have a file with 5 columns with some numbers in 16 lines as shown below. Input file: Col 1 Col 2 Col 3 Col 4 Col 5 12 220 2 121 20 234 30 22 9... (3 Replies)
Discussion started by: Fredrick
3 Replies

7. UNIX for Dummies Questions & Answers

Request for Formatted Output

Can you please tell me how to just get only the output of dealers I & V information along with their subtotals in the next line of the file and create a new file, The dealer position along with corresponding totals may change everyday to any position above or below in the file, please help Thanks (2 Replies)
Discussion started by: Ariean
2 Replies

8. Programming

Formatted output in PERL

Hi Techies, I'm a newbie to PERL, Please help me with following problem. I have an input text file like below cat Input.txt 418673132,P 492538858,P 384535478,P 521522357,I 529435679,I 183617024,P 184414408,I 735510689,P 736238343,I 411642045,I 412690979,I 104232783,I (2 Replies)
Discussion started by: mahi_mayu069
2 Replies

9. Shell Programming and Scripting

Shell Script for formatted output

06/26/2017 23:40:40 CAUAJM_I_10082 06/26/2017 23:40:40 CAUAJM_I_40245 EVENT: CHANGE_STATUS STATUS: STARTING JOB: IOALPPRXXBD_ALPGLGENFAALL MACHINE: aspsun14 06/26/2017 23:40:42 CAUAJM_I_40245 EVENT: CHANGE_STATUS STATUS: RUNNING JOB:... (10 Replies)
Discussion started by: Sandeep Behera
10 Replies

10. Shell Programming and Scripting

Print commas between awk output

When I output fields 1 2 4 5 & 6, I would like to have a comma between them but I am beating my head against the wall to get it to work. Any help is appreciated sed 's/]*,]*/,/g' file1 > file1.$$ && awk -F, 'FNR==NR{f2=$1 $2 $4 $5 $6;next} FNR==1{print $0, "CDP NE Hostname,CDP NE IP,Remote... (6 Replies)
Discussion started by: dis0wned
6 Replies
NUMFMT_SET_SYMBOL(3)							 1						      NUMFMT_SET_SYMBOL(3)

NumberFormatter::setSymbol - Set a symbol value

	Object oriented style

SYNOPSIS
public bool NumberFormatter::setSymbol (int $attr, string $value) DESCRIPTION
Procedural style bool numfmt_set_symbol (NumberFormatter $fmt, int $attr, string $value) Set a symbol associated with the formatter. The formatter uses symbols to represent the special locale-dependent characters in a number, for example the percent sign. This API is not supported for rule-based formatters. PARAMETERS
o $fmt -NumberFormatter object. o $attr - Symbol specifier, one of the format symbol constants. o $value - Text for the symbol. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 numfmt_set_symbol(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::DECIMAL ); echo "Sep: ".numfmt_get_symbol($fmt, NumberFormatter::GROUPING_SEPARATOR_SYMBOL)." "; echo numfmt_format($fmt, 1234567.891234567890000)." "; numfmt_set_symbol($fmt, NumberFormatter::GROUPING_SEPARATOR_SYMBOL, "*"); echo "Sep: ".numfmt_get_symbol($fmt, NumberFormatter::GROUPING_SEPARATOR_SYMBOL)." "; echo numfmt_format($fmt, 1234567.891234567890000)." "; ?> Example #2 OO example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL ); echo "Sep: ".$fmt->getSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL)." "; echo $fmt->format(1234567.891234567890000)." "; $fmt->setSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL, "*"); echo "Sep: ".$fmt->getSymbol(NumberFormatter::GROUPING_SEPARATOR_SYMBOL)." "; echo $fmt->format(1234567.891234567890000)." "; ?> The above example will output: Sep: . 1.234.567,891 Sep: * 1*234*567,891 SEE ALSO
numfmt_get_error_code(3), numfmt_get_symbol(3). PHP Documentation Group NUMFMT_SET_SYMBOL(3)
All times are GMT -4. The time now is 08:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy