The UNIX and Linux Forums
>
Top Forums
>
UNIX for Dummies Questions & Answers
Append 0 for single digit entered from command line
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
Append 0 for single digit entered from command line
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
1
(
permalink
)
08-24-2007
namishtiwari
Registered User
Join Date: Aug 2007
Location: Bangalore
Posts: 377
Append 0 for single digit entered from command line
I have a script like this--
#!/bin/ksh
echo "To pad a 0 before digits from 1-9"
for i in $*
do
echo $i |
sed
's/[1-9]/'0[1-9]'/g'
done
I run this script as
ksh name 1 2 23 34
The output should be
01 02 23 34
Help me in modifying this script.
Thanks
Namish
namishtiwari
View Public Profile
Find all posts by namishtiwari
Find namishtiwari's past nominations received
Find namishtiwari's present nominations given