parsing a string

hi
i am new to Shell scripting
i have a string "hostName=lpdma520_dev_ipc_us_aexp_com"
now i need to parse the string as "var1=lpdma520"

please help

same query has beed answered to u previously

hi aju,
previously we replaced .(dot) with _(underscore)
now i need the parse the string
please help

$ hostName=lpdma520_dev_ipc_us_aexp_com
$ echo ${hostName%%_*}
lpdma520
$
hostname="lpdma520_dev_ipc_us_aexp_com"
var1="${hostname%%_*}"
echo $var1

hi aju
it is working fine and i have one more need
i want to assign lpdma520 to a variable. i am trying to do that one.

Please help

$ hostName=lpdma520_dev_ipc_us_aexp_com
$ newver=${hostName%%_*}
$ echo $newver
lpdma520
$

That is already done in the script above to your last post.

Thanks
Namish