Sponsored Content
Top Forums Shell Programming and Scripting Printf statement for currency conversion Post 302914503 by Scrutinizer on Tuesday 26th of August 2014 07:37:20 AM
Old 08-26-2014
Quote:
Originally Posted by hemanthsaikumar
hi
in awk command can we do the same..?
Sure:
Code:
amount=1000
awk -v fmt="%'d\n" -v amount="$amount" 'BEGIN{printf fmt, amount}'


Last edited by Scrutinizer; 08-26-2014 at 08:42 AM..
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

AWK Currency Conversion

How can I use awk command to convert values to currency. For example I have a database like follows John:200 smith:300 kim:405 and want it to out put like this John $200.00 (3 Replies)
Discussion started by: 3junior
3 Replies

2. Shell Programming and Scripting

Format Money/Currency (U.S.)

I have looked everywhere. Does bash have a money/currency format for output? Do I have to use awk or printf? Thank you (4 Replies)
Discussion started by: Ccccc
4 Replies

3. Shell Programming and Scripting

Printf statement

The printf statement pay_amount=$(printf "%013.3f" "$4") working perfectly at one path(xxx/home/rsh) and showing error (printf: 216.000: invalid number) at another path(/opt/xxxx/xxxx). what will be the reason? thanks in advance (4 Replies)
Discussion started by: reeta_shri
4 Replies

4. Shell Programming and Scripting

Maintaining file currency

I have a common data folder with files like x* which is accessed by 3 unix servers. Now each server will try to pick one file form this folder and move it to its local folder. How to maintain file concurrency in this case?I dont want the same file to be accessed by more than one process. (2 Replies)
Discussion started by: prasperl
2 Replies

5. Shell Programming and Scripting

NAWK conversion of hexadecimal input to decimal output via printf, I am close I can feel it

I have searched and the answers I have found thus far have led me to this point, so I feel I am just about there. I am trying to convert a column of hexadecimal to decimal values so that I can filter out via grep just the data I want. I was able to pull my original 3 character hex value and... (10 Replies)
Discussion started by: PCGameGuy
10 Replies

6. Shell Programming and Scripting

creating printf statement using user arguments

I am writing a script in bash and want to perform the operation I check number of arguments and make a print statement with the passes arguments If I pass 3 arguments I will do printf "$frmt" "$1" "$2" "$3"If I have 4 arguments I do printf "$frmt" "$1" "$2" "$3" "$4"etc (4 Replies)
Discussion started by: kristinu
4 Replies

7. Programming

Printf conversion specifiers

Hello, this is one examples that I always panic with C printf format specifier. 1) I did read the manpage with man 3 printf ...... One can also specify explicitly which argument is taken, at each place where an argument is required, by writing "%m$" instead of '%' and "*m$"... (10 Replies)
Discussion started by: yifangt
10 Replies

8. Shell Programming and Scripting

How to add printf statement in awk command?

hi all i need to add the prinf statement in awk command for the converted comma separated output.... below is my code : Code Credits :RudiC awk -F, 'NF==2 {next} {ITM=$1 AMT=$2+0 CNT=$3+0 TOTA+=$2 ... (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies
TAU_TRACK_MEMORY_HEA(3) 				      TAU Instrumentation API					   TAU_TRACK_MEMORY_HEA(3)

NAME
TAU_TRACK_MEMORY_HEADROOM - Track the headroom (amount of memory for a process to grow) by periodically interrupting the program SYNOPSIS
C/C++: TAU_TRACK_MEMORY_HEADROOM(void); Fortran: TAU_TRACK_MEMORY_HEADROOM(void); DESCRIPTION
Tracks the amount of memory available for the process before it runs out of free memory on the heap. This call sets up a signal handler that is invoked every 10 seconds by an interrupt (this interval may be altered by using the TAU_SET_INTERRUPT_INTERVAL call). Inside the interrupt handler, TAU evaluates how much memory it can allocate and associates it with the callstack using the TAU context events (See TAU_REGISTER_CONTEXT_EVENT(3)). The user can vary the size of the callstack by setting the environment variable TAU_CALLPATH_DEPTH (default is 2). This call is useful on machines like IBM BG/L where no virtual memory (or paging using the swap space) is present. The amount of heap memory available to the program is limited by the amount of available physical memory. TAU executes a series of malloc calls with a granularity of 1MB and determines the amount of memory available for the program to grow. EXAMPLE
C/C++ : TAU_TRACK_MEMORY_HEADROOM(); Fortran : call TAU_TRACK_MEMORY_HEADROOM() SEE ALSO
TAU_TRACK_MEMORY(3), TAU_SET_INTERRUPT_INTERVAL(3), TAU_ENABLE_TRACKING_MEMORY_HEADROOM(3), TAU_DISABLE_TRACKING_MEMORY_HEADROOM(3), TAU_TRACK_MEMORY_HEADROOM_HERE(3) 08/31/2005 TAU_TRACK_MEMORY_HEA(3)
All times are GMT -4. The time now is 12:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy