using sed on bash variables (or maybe awk?)

Hi all-

I've been fooling with this for a few days, but I'm rather new at this...

I have a bash variable containing a long string of various characters, for instance:

JUNK=this that the other xyz 1234 56 789

I don't know what "xyz" actually is, but I know that:
START=he other
and
STOP=123
In other words, "he other" and "123" are kind of delimiters for whatever "xyz" is.

So, how can I feed sed (or maybe awk?) the variables $JUNK, $START and $STOP to extract "xyz" (and assign it to another variable) without knowing what "xyz" is?

Any hints would be great!

-Rev66

You don't need ''sed'' or ''awk''; the shell has parameter expansion that is much faster than calling an external utility.

JUNK="this that the other xyz 1234 56 789"
temp=${JUNK#*he other }
extract=${temp% 123*}

Read the "Parameter Expansion" section of your shell man page for more infromation.

for a simple case like OP's, true. however if it comes from a file, especially if its big file, it might be faster to use awk/sed.