I want an integer to be prefix with some zeros so that it makes the integer 5 digit always:
For eg: if the digit is 8 i need 00008
if the digit is 8976 ans sud be 08976.
Could anyone say simple and efficient commands to this in ksh.
Thanks a lot...
I want an integer to be prefix with some zeros so that it makes the integer 5 digit always:
For eg: if the digit is 8 i need 00008
if the digit is 8976 ans sud be 08976.
Could anyone say simple and efficient commands to this in ksh.
Thanks a lot...
hI.
You could create the variable with...
typeset -Z5 VAR=1234
echo $VAR
01234
or...
VAR=$(printf "%05d" 1234)
echo $VAR
01234
thanks a lot scottn... it worked...
how can same be done in bash?
I never use bash, so I don't know the typeset equivalent, but the printf method works.