OK, so if I understand correct, your exact string is
name="request - env - dont- want - this string.xml"
It's not that you have a variable 'name' with the value
request - env - dont- want - this string.xml
Of not, could you please print some of you're script?
OK, so try this:
1:
2:
|
name="request - env - dont- want - this string.xml"
echo ${name} | awk ' BEGIN { FS = "\"" } ; { print $2 }' | awk ' BEGIN { FS = "-" } ; { print $1"-"$2 }'
|