I have a string that looks like this
LOCATION="/home/dev/V1.0_MODULENAME_yyyyMMdd_hhss.tar"
I would like to parse it such that i get the module name.
I tried a k shell script with following commands...
MODULE=${LOCATION:20:32}
MODULE=${LOCATION#*_}

First one doesnt compile saying the specified substitution is not a valid command
and the second one gives part of what is required.

Can someone suggest the best way to get the modulename from my string

echo $LOCATION | awk -F"_" '{print $2}'
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.