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!

Stripping away the zero's

Status
Not open for further replies.

SLG

MIS
Dec 19, 2001
106
US
I have a string of numbers in sequential order starting at 00001 and going all the way up to 99999. Ex:

00001
00022
00345
00561
01304
20292

What I want is the same list but with out the zeros so it looks like

1
22
345
561
1304
20292

How would I go about that?

Thanks in advance!!!
 
well.. cat is not necessary:

awk '{printf("%d\n",$1)}' list.txt

(obviously, list.txt has all numbers)

Chacal, Inc.[wavey]
 
Sweet! That works like a charm thanks!
 
Another way:
sed 's!^00*!!' /path/to/input > output

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top