The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Extract numbers from a string and store in variables
.
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
:
Extract numbers from a string and store in variables
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
4
(
permalink
)
11-13-2007
lione.heart
Registered User
Join Date: Oct 2007
Posts: 13
#!/bin/ksh
str="5.2.314"
Var1=`echo $str | awk -F\. '{print $1}'`
Var2=`echo $str | awk -F\. '{print $2}'`
Var3=`echo $str | awk -F\. '{print $3}'`
echo "$Var1 $Var2 $Var3"
enjoy
lione.heart
View Public Profile
Find all posts by lione.heart
Find lione.heart's past nominations received
Find lione.heart's present nominations given