When running the following
echo "abc>asf<tfg"|sed 's/.*>\(.*\)</\1/'
The output is:
asftfg
I don't understand why tfg
gets printed? My expected result is asf. Though, it works fine in the following.
expr `echo "abc>asf<tfg"` : '.*>\(.*\)<'
Which gets me:
asf
And help me to extract the string between >
and <
when input is being received from a pipe.