Remove Leading 0’s in Bash

March 12, 2010    bash linux Sys Admin

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:~$



comments powered by Disqus