Question : string extract

I have following string
name="request - env - dont- want - this string.xml"
Is this possible to extract string [request - env] from above string in shell script
[request - env] is dynamic string.
means string with only first -

Answer : string extract

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 }'
Random Solutions  
 
programming4us programming4us