Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Remove first 3 leadings zeros and replace with space Post 303004822 by RavinderSingh13 on Monday 9th of October 2017 05:38:34 PM
Old 10-09-2017
Hello SIMMS7400,

Could you please try following awk too and let me know if this helps you.
Code:
awk --re-interval -F"|" '{sub(/^0{3}/,"",$2)} 1' OFS="|"   Input_file

I have old version of awk, so in case you have latest version of awk, you could use it without --re-interval too.

Thanks,
R. Singh
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

remove precursing zeros

Hello all, I have a list of reports for stores that are numbered like: s001845,s000022,s198490,s020048,s002385 however the users are displaying the reports as: 1845,22,198490,20048,2385 It isn't real critical but I would like to associate them so they are the same. And since the users are... (2 Replies)
Discussion started by: gozer13
2 Replies

2. Shell Programming and Scripting

Remove O and preceeding zeros in a string

Hi all, Can anybody help me out to write a program in perl to remove O and preceeding zeros. for eg input is O0000123089 - output 123089 Thanks Mahalakshmi.A (10 Replies)
Discussion started by: mahalakshmi
10 Replies

3. Shell Programming and Scripting

awk to remove leading zeros for a hex number

Is it possible by using awk to remove leading zeros for a hex number? ex: 0000000011179E0A -> 11179E0A Thank you! (4 Replies)
Discussion started by: carloszhang
4 Replies

4. Shell Programming and Scripting

Remove trailing zeros

Hi I have a simple request but can't find the answer. I want to remove trailing zeros, and in some cases the fullstops, from the input data. Example of input file: FR002_15.000_20.000 SD475_5.000_10.500 FG5647_12.250_15.500 BH2463_30.555_32.000 Desired output file would be: ... (10 Replies)
Discussion started by: theflamingmoe
10 Replies

5. UNIX for Dummies Questions & Answers

Remove zeros from first field, but print all fields

Hello Everyone, I've got a comma-delimited file that looks like this: 0012,123 ,456 ,05/12/2014 0123,525 ,286 ,05/12/2014 0456,791 ,300 ,05/12/2014 1095,759 ,300 ,05/12/2014 1344,576 ,292 ,05/12/2014 1558,551 ,283 ,05/12/2014 002183719, , ... (9 Replies)
Discussion started by: Scottie1954
9 Replies

6. Shell Programming and Scripting

Fixed with file- removing leading zeros and adding the space

Hi All, i have a fixed width file , where each line is 3200 length. File: 1ABC 1111 2222 3333 000012341 1001 2ABC 1111 2222 3333 000012342 1002 3ABC 1111 2222 3333 000112343 1003 1DEF 5555 4444 9696 000012344 1004 2DEF 5555 2323 8686 000012345 1005 3DEF 5555 1212 7676 000012346 1006 ... (1 Reply)
Discussion started by: mechvijays
1 Replies

7. UNIX for Beginners Questions & Answers

Remove characters and replace with space

tr -cd '\11\12\15\40-\176' < file-with-binary-chars > clean-file This removes special characters but how can I replace it with space (4 Replies)
Discussion started by: eskay
4 Replies

8. Shell Programming and Scripting

Ho to remove leading zeros from a csv file which is sent from a UNIX script

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

9. Shell Programming and Scripting

Remove leading zeros separated by pipe

I have a below file and I wanted to remove the leading zeros in each field separated by pipe File: 01/09/2017|2017/09/06|2017/02/06|02/06/2017|02/06/2017 06:50:06 AM|2017/02/06|02/06/2017|02/07/2017 05:45:06 AM| 02/08/2017|2017/08/06|2017/09/06|02/05/2017|02/07/2017 05:40:06... (4 Replies)
Discussion started by: Joselouis
4 Replies

10. UNIX for Beginners Questions & Answers

Remove trailing zeros from numbers

Hi, I am trying to remove trailing zeros from numbers in a csv file. CSV Input : 0.5000,abc,2.00,2.400,285.850,285a.850,205.180800,mno000,a0b0,2.860 Expected Output : .5,abc,2,2.4,285.85,285a.850,205.1808,mno000,a0b0,2.86 Can you please help. Thanks. (11 Replies)
Discussion started by: manubatham20
11 Replies
strtol(3C)																strtol(3C)

NAME
strtol(), atol(), atoll(), atoi(), strtoul(), strtoll(), strtoull() - convert string to integer SYNOPSIS
DESCRIPTION
or converts the character string pointed to by str to or representation, respectively. or converts the character string pointed to by str to or representation, respectively. The string is scanned up to the first character inconsistent with the base. Leading "white-space" characters (as defined by in ctype(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 string itself determines the base as follows: after an optional leading sign, a leading zero indicates octal conver- sion; a leading or indicates hexadecimal conversion. Otherwise, decimal conversion is used. If the value of ptr is not a pointer to the character terminating the scan is returned in the location pointed to by ptr. If no integer can be formed, the location pointed to by ptr is set to str, and zero is returned. is equivalent to is equivalent to is equivalent to RETURN VALUE
Upon successful completion, all 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 returns or (according to the sign of the value), 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
ctype(3C), strtod(3C), strtoimax(3C), scanf(3S), thread_safety(5), glossary(9). STANDARDS CONFORMANCE
strtol(3C)
All times are GMT -4. The time now is 07:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy