How to parse the given word

Hi ,

i need to parse the dir /opt/net/Pro/inv/do/disc_001812 to get only dsic001812 . how to do the same using shell script.

Try:

x=/opt/net/Pro/inv/do/disc_001812
basename $x

or,

echo $x | awk -F"/" '{ print $NF}'

Thanks dennis.