I have a shell script withstring=<deploymentTargets xmi:type=appdeployment:ClusteredTarget xmi:id=ClusteredTarget_1433783657353 name=cluster1/>I want the value between name= and /> which is cluster1. This output should be stored to another variable. 
sed or awk to get a string
bash;sed;awk;string
For the specific example you show, all of these will save cluster1 in the variable $name:sedname=$(sed 's/.*=\(.*\).*/\1/' <<<$string )GNU grep (compiled with PCRE support)name=$(grep -oP '[^]+(?=/>)'<<<$string )Perlname=$(perl -pe 's/.*=(.*).*/\1/' <<<$string )If your shall doesn't support the <<< operator, change your preferred approach to using printf or echo instead:name=$(printf '%s' $string | sed 's/.*=\(.*\).*/\1/')name=$(printf '%s' $string | grep -oP '[^]+(?=/>)')name=$(printf '%s' $string | perl -pe 's/.*=(.*).*/\1/')IMPORTANT: this will only work on the example you show. For more complex XML structures, including nested tags etc, you really should use a dedicated XML parser.