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
curs_printw(3X) 														   curs_printw(3X)

NAME
printw, wprintw, mvprintw, mvwprintw, vwprintw, vw_printw - print formatted output in curses windows SYNOPSIS
#include <curses.h> int printw(char *fmt [, arg] ...); int wprintw(WINDOW *win, char *fmt [, arg] ...); int mvprintw(int y, int x, char *fmt [, arg] ...); int mvwprintw(WINDOW *win, int y, int x, char *fmt [, arg] ...); #include <varargs.h> int vwprintw(WINDOW *win, char *fmt, varglist); int vw_printw(WINDOW *win, char *fmt, varglist); DESCRIPTION
The printw, wprintw, mvprintw and mvwprintw routines are analogous to printf [see printf(3S)]. In effect, the string that would be output by printf is output instead as though waddstr were used on the given window. The vwprintw routine is analogous to vprintf [see printf(3S)] and performs a wprintw using a variable argument list. The third argument is a va_list, a pointer to a list of arguments, as defined in <varargs.h>. RETURN VALUE
Routines that return an integer return ERR upon failure and OK (SVr4 only specifies "an integer value other than ERR") upon successful com- pletion. PORTABILITY
The XSI Curses standard, Issue 4 describes these functions. The function vwprintw is marked TO BE WITHDRAWN, and is to be replaced by a function vw_printw using the <stdarg.h> interface. SEE ALSO
curses(3X), printf(3S), vprintf(3S) curs_printw(3X)
All times are GMT -4. The time now is 11:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy