Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formatting a Number field(s)

Status
Not open for further replies.

RJSHA1

Programmer
Apr 12, 2001
66
0
0
GB
Hi there,
I have two variables COUNT and AMOUNT (I know original variable names), I want to format these two variables so that they have leading zeroes and I then want to add them to a file.
I cannot get the variables to have leading zeroes I'm using the following command what am I doing wrong

FRMAMOUNT=`printf "%+015" $AMOUNT`

$AMOUNT has a value of 163022578
 
#!/bin/ksh

typeset -Z15 AMOUNT=163022578
echo ${AMOUNT}

# 000000163022578

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Thanks predamarcel,
I was missing the {}'s

regards Bob...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top