08-04-2008
echo $d | awk '{printf("%02d",$d)}'
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm trying to write a script that compare's some numeric values in a file, but in one of the files the value always has leading zero's. For example -
temp_8719_LM344_20031216091826: printera : 552 : 276 : 552 : 276
temp_8719_LM344_20031216091826: printera : 000552 :000276 : 000552 : 000276
... (5 Replies)
Discussion started by: dbrundrett
5 Replies
2. Shell Programming and Scripting
How to insert leading zeros into a left-justisfied zip code?
e.g. Zip code is written as 60320 which is left-justified to make it be read as 0060320.
We have to move it to right-justifiable then insert 2 leading zeros into it... ;) (1 Reply)
Discussion started by: wtofu
1 Replies
3. UNIX for Dummies Questions & Answers
Hi,
I do have a code as follows:
function deHex {
if ]; then
deHexDate=${1:1:$2}
fi
}
The description given for the above code is as follows:
# description: removes leading zero so value will not be recognized as hex
# usage: deHex <value_parameter> <value_input_length>
... (0 Replies)
Discussion started by: risshanth
0 Replies
4. Shell Programming and Scripting
Hello, I am (trying) to write a script that will check to see how many users are logged on to my machine, and if that number is more than 60 I need to kill off all the oldest sessions that are over 60. So far I have been able to check how many users are on and now I am at the part where I have to... (3 Replies)
Discussion started by: raidzero
3 Replies
5. Shell Programming and Scripting
Hi,
Can anyone help me how to add leading zero's (0's) infront of numbers in unix script.
For more details.
x=450
Y=2344
i want the out put of 00000450, 000002344 (leading 5 zeros)
Thanks
A. Raj. (8 Replies)
Discussion started by: easterraj
8 Replies
6. Shell Programming and Scripting
I need to add leading zeros in a floating point numbers.
The length of the number should be 13 including decimal.
The input number is changing so number of leading zeros is not fix.
For example
input output
216.000 000000216.000
1345.000 000001345.000
22345.500 ... (4 Replies)
Discussion started by: reeta_shri
4 Replies
7. Shell Programming and Scripting
hi All
i am new to linux...
source txt ..
281-BUM-5M BUM-5M 0 0
282-BUM-5M BUM-5M 0 0
83-BUM-5M BUM-5M 0 0
is it possible to use bash script to convert to
(remove the "-" and fill up to 4 digit" ?
0281 BUM-5M BUM-5M 0 0
0282 BUM-5M BUM-5M 0 0
0083 BUM-5M BUM-5M 0 0
thanks a ... (5 Replies)
Discussion started by: samoptimus
5 Replies
8. UNIX for Dummies Questions & Answers
Hello Gurus,
Quick question. I have a file with the following records:
A~000000000000518000~SLP ~99991231~20090701~88.50~USD~CS~
A~000000000000518000~SLP ~99991231~20090701~102.00~USD~CS~
A~000000000000772000~SLP ~99991231~20100701~118.08~USD~CS~
I wold like to do the following:
1. Add... (1 Reply)
Discussion started by: chumsky
1 Replies
9. Shell Programming and Scripting
Hello.
I'm trying to add multiple numbers with varying length and with leading zeroes in it. However, I'm getting the sum (totalHashAccountNumber) without the leading zeroes in it. How do I retain the leading zeroes?
Please pardon the lengthy code.. I'm getting the hash account number from 2... (2 Replies)
Discussion started by: udelalv
2 Replies
10. Shell Programming and Scripting
Hi
Ich have a list as follows
73
5
100
45
81
4
and I would like to have an output (on screen) like that
73
5
100
45
81
4 (6 Replies)
Discussion started by: lazybaer
6 Replies
wcstol(3C) wcstol(3C)
NAME
wcstol(), wcstoll(), wcstoul(), wcstoull() - convert wide character string to long integer
SYNOPSIS
Remarks
These functions are compliant with the XPG4 Worldwide Portability Interface wide-character formatting functions. They parallel the 8-bit
character formatting functions defined in strtol(3C).
DESCRIPTION
or converts the wide character string pointed to by nptr to or representation, respectively. or converts the wide character string pointed
to by nptr to or representation, respectively. The wide character string is scanned up to the first wide character inconsistent with the
base. Leading "white-space" wide characters (as defined by in wctype(3C)) are ignored. If no conversion can take place, zero is returned.
If base is greater than or equal to 2 and less than or equal to 36, it is used as the base for conversion. After an optional leading sign,
leading zeros are ignored, and or is ignored if base is 16.
If base is zero, the wide character string itself determines the base as follows: after an optional leading sign, a leading zero indicates
octal conversion; a leading or indicates hexadecimal conversion. Otherwise, decimal conversion is used.
If the value of endptr is not a pointer to the wide character terminating the scan is returned in the location pointed to by endptr. If no
integer can be formed, the location pointed to by endptr is set to nptr, and zero is returned.
Definitions for these functions and the type are provided in the header file.
EXTERNAL INFLUENCES
Locale
The category determines how wide character codes are interpreted.
International Code Set Support
Single- and multi-byte character code sets are supported.
RETURN VALUE
Upon successful completion, both functions return the converted value, if any.
If the correct value would cause overflow:
returns or (according to the sign of the value), and sets to
returns and sets to
returns or (according to the sign of the value), and sets to
returns and sets to
For all other errors, zero is returned and is set to indicate the error.
ERRORS
and fail and is set, if any of the following conditions are encountered:
The value of base is not supported.
The value to be returned would have caused overflow.
AUTHOR
These interfaces were developed by OSF and HP.
SEE ALSO
wctype(3C), wcstod(3C), wcstoimax(3C), scanf(3S), thread_safety(5), glossary(9).
STANDARDS CONFORMANCE
wcstol(3C)