To extract substring between two character: Shell Script

var1='mysql-'
var2='-linux'
mysqlFromWhichCommand=/usr/local/mysql-5.1.38-linux-i686-icc-glibc23/bin/mysql
versionMysql=`echo "$mysqlFromWhichCommand" | sed -e "s/.*${v1}//;s/${v2}.*//"``
echo "MySql version: $versionMysql"

Comments

Popular posts from this blog

attach file gives false disk address path as 'C:/fakepath/filename'

How to fix World-writable config file /etc/my.cnf is ignored?

Ajmer tour on 18th June '11