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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

remove 0s

Status
Not open for further replies.

ovince

Programmer
Feb 27, 2007
55
FR
I posted this message to awk forum but other solutions are accepted too.

Hi

Does anybody have an idea how to remove leading zeros from this data ie. to transform this


HD000245
HD001358
HD020400
HD000093
HD000007
........

to

HD245
HD1358
HD20400
HD93
HD7
.......

thanks
o
 
sed 's!^\(..\)0*!\1!' /path/to/input > output

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Slightly off topic - but related...

I saw this question over in the AWK forum earlier today. Now, however, it appears to be gone. Where did it go?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top