Monday, August 25, 2014

Substring - Shell Command

$ export DUMP_PATH=/tmp/products/exp_full_DEMO_1_1.dmp
 
#delete matching pattern from beginning
$ export TMP=${DUMP_PATH#*/exp_}  $ echo $TMP
full_DEMO_1_1.dmp
 
#delete matching pattern from end
$ export EXPORT_FILE=${TMP%.dmp}  
$ echo $EXPORT_FILE
full_DEMO_1_1