Sponsored Content
Full Discussion: Decimal Padding in Decimal
Top Forums Shell Programming and Scripting Decimal Padding in Decimal Post 302970558 by RudiC on Friday 8th of April 2016 03:22:05 AM
Old 04-08-2016
Or
Code:
awk '{printf "%*.*f\n", FL, FL-1-length(int($1)), $1}' FL=10 file
234.234000
12.4000000
3456.56780

This User Gave Thanks to RudiC For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Decimal format

Hello Friends, I have a file with below format... 1234,Hary,102.55 4567,Maria,250.40 78942,suzan,261.60 48965,Harun,179.32 And I want to check the last column. If the decimal value of the last column is below 50, I need that column else ignore that column. Can anyone help me out? (3 Replies)
Discussion started by: mziaullah
3 Replies

2. UNIX for Dummies Questions & Answers

Decimal to BCD (Binary Coded Decimal)

Anybody please help me... Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary Coded Decimal) representation. Also, draw its Flow Chart. This is a unix qn... plz post algorithm for that :confused: (1 Reply)
Discussion started by: caramba
1 Replies

3. Homework & Coursework Questions

Decimal to BCD (Binary Coded Decimal)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary... (2 Replies)
Discussion started by: caramba
2 Replies

4. Shell Programming and Scripting

Formatting - decimal value

Hi all, I need some input concerning formatting a decimal value. I'd like to format a decimal as follows: Decimal length = 8, precision = 2, signed (+ for postive, - for negative) Examples Input Output 0 +000000.00... (5 Replies)
Discussion started by: Noobie1995
5 Replies

5. UNIX for Dummies Questions & Answers

Convert hexa decimal to decimal

Hi, I want to convert two hexadecimal numbers to decimal using unix command line. 1cce446295197a9d6352f9f223a9b698 fc8f99ac06e88c4faf669cf366f60d I tried using `echo "ibase=16; $no |bc` printf '%x\n' "1cce446295197a9d6352f9f223a9b698" but it doesn't work for such big number it... (4 Replies)
Discussion started by: sudhakar T
4 Replies

6. Shell Programming and Scripting

How to trim the zero's after decimal?

Hello all, I have an XML with below content from which i need to remove the trailing zeros, like 123.00 should be converted to 123 and 123.01200 to 123.012 Below is the sample excerpt data from XML file. My input file size could be approximately 5 GB or less. CURRENT:... (10 Replies)
Discussion started by: Ariean
10 Replies

7. Programming

Urgent help needed.. C++ program to convert decimal to hexa decimal

Hi , seq can be 0...128 int windex = seq / 8; int bindex = seq % 8; unsigned char bitvalue = '\x01' << (7-bindex) ; bpv.bitmapvalue = bitvalue; This is the part of a program to convert decimal to bitmap value of hexadecimal. I want this to change to convert only to... (1 Reply)
Discussion started by: greenworld123
1 Replies

8. Shell Programming and Scripting

Zero padding a Number before and after a decimal place

Hi I was hoping someone could help me with a sed script I am trying to write? I am on a Mac running ElCapitan I have some text that I have converted from a pdf that I want to format into an xml file. In the file I have managed to delete all the text I do not need. The text I have left is... (8 Replies)
Discussion started by: Paul Walker
8 Replies

9. Shell Programming and Scripting

Sum the fields with 6 decimal places - getting only 2 decimal places as output

I used the below script to Sum up a field in a file based on some unique values. But the problem is when it is summing up the units, it is truncating to 2 decimals and not 6 decimals as in the input file (Input file has the units with up to 6 Decimals – Sample data below, when the units in the 2... (4 Replies)
Discussion started by: brlsubbu
4 Replies
NUMFMT_FORMAT_CURRENCY(3)						 1						 NUMFMT_FORMAT_CURRENCY(3)

NumberFormatter::formatCurrency - Format a currency value

	Object oriented style

SYNOPSIS
public string NumberFormatter::formatCurrency (float $value, string $currency) DESCRIPTION
Procedural style string numfmt_format_currency (NumberFormatter $fmt, float $value, string $currency) Format the currency value according to the formatter rules. PARAMETERS
o $fmt -NumberFormatter object. o $value - The numeric currency value. o $currency - The 3-letter ISO 4217 currency code indicating the currency to use. RETURN VALUES
String representing the formatted currency value. EXAMPLES
Example #1 numfmt_format_currency(3) example <?php $fmt = numfmt_create( 'de_DE', NumberFormatter::CURRENCY ); echo numfmt_format_currency($fmt, 1234567.891234567890000, "EUR")." "; echo numfmt_format_currency($fmt, 1234567.891234567890000, "RUR")." "; $fmt = numfmt_create( 'ru_RU', NumberFormatter::CURRENCY ); echo numfmt_format_currency($fmt, 1234567.891234567890000, "EUR")." "; echo numfmt_format_currency($fmt, 1234567.891234567890000, "RUR")." "; ?> Example #2 OO example <?php $fmt = new NumberFormatter( 'de_DE', NumberFormatter::CURRENCY ); echo $fmt->formatCurrency(1234567.891234567890000, "EUR")." "; echo $fmt->formatCurrency(1234567.891234567890000, "RUR")." "; $fmt = new NumberFormatter( 'ru_RU', NumberFormatter::CURRENCY ); echo $fmt->formatCurrency(1234567.891234567890000, "EUR")." "; echo $fmt->formatCurrency(1234567.891234567890000, "RUR")." "; ?> The above example will output: 1.234.567,89 EUR 1.234.567,89 RUR 1 234 567,89EUR 1 234 567,89. SEE ALSO
numfmt_get_error_code(3), numfmt_format(3), numfmt_parse_currency(3). PHP Documentation Group NUMFMT_FORMAT_CURRENCY(3)
All times are GMT -4. The time now is 11:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy