I have a string where I need to extract a substring from, but the end of my regex is repeated. I would like to sed to stop at the first instance of the end of my regex, much like instr() functions in many languages return the first instance. Example:
echo "This is a test some stuff I want string junk string end" | sed -n 's/.*\(.te.*ng\).*/\1/p'
returns: test some stuff I want string junk string
I want to return: test some stuff I want string