and with a POSIX conforming version of sed:
Note, however, that both of the above suggestions, when given the 6th line of your sample input:
produce the output:
not the output you said you want:
I don't see how transforming :06 by removing a leading zero should result in producing :56???
This User Gave Thanks to Don Cragun For This Post:
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)
Hi All,
I am working with a fixed width file Forrmat.
C1 Number (10,3)
C2 Number (10,3)
e.g.
c1= 0000000100.000
c2= 0000000020.000
0000000100.0000000000020.000
I have to perform c1 - c2 . i.e. I want answer to be 0000000080.000. but I am loosing the leading zeros( only getting... (3 Replies)
Hi all,
I have file with numeric values. I need to pad each value with leading zeros such that total lenght of each value is 16.
Example:
cat tmp.txt
502455
50255
5026
5027
5028
Output
0000000000502455
0000000000050255
0000000000005026
0000000000005027
0000000000005028
Any... (12 Replies)
Hi
i need help in adding leading zero to filenames
e.g file name in my folder are
1_234sd.txt
23_234sd.txt
the output i need is
001_234sd.txt
023_234sd.txt
can i do this shell scripting
please help (2 Replies)
Hi,
i have a variable which conatins values like 00001,0003,00067,00459.
I want to use the values one by one and in the same form as they are like 00001,0003,00067,00459.
Also can anyone tell me how to increment those numbers by 1,keeping the format as same like 00002,0004,00068,00460.... (5 Replies)
I have a list of numbers extracted and need to delete the leading zeros from them, but when i do so, the command I am using also deletes numbers that end in Zero as well. eg 10, 20, 30, etc
this is part of a larger script and the only way I can think of is to try and detect the 10,20 30 etc in... (19 Replies)
Hi All,
I am using a informatica job to create a csv file and a unix script the mail the generated file.Everything is working fine but I am not seeing leading zeros in the csv file sent in the mail.These zeros were present when the .csv file was generated by informatica procees.
Is there any... (11 Replies)
Discussion started by: karthik adiga
11 Replies
LEARN ABOUT HPUX
wcstol
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)