« Make the HP dv2120us webcam work in Linux | Main | Great Examples of mySQL Queries »

Remove Leading 0's in Bash

So you have a var you want to remove leading 0's on.. well do the follwing

mzupan@mzupan-desktop:~$ var=00014
mzupan@mzupan-desktop:~$ let var="10#$var"
mzupan@mzupan-desktop:~$ echo $var
14
mzupan@mzupan-desktop:~$

TrackBack

TrackBack URL for this entry:
http://www.zcentric.com/cgi-bin/mt-tb.cgi/9

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About

This page contains a single entry from the blog posted on January 25, 2007 11:11 AM.

The previous post in this blog was Make the HP dv2120us webcam work in Linux.

The next post in this blog is Great Examples of mySQL Queries.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33