Using sed with this regular expression:
message=$(echo "$path" | sed -E 's/(.+pattern[0-9][0-9]*).+/\1/')
With this expression, lines like this:
will be replaced by:
whereas I would like them to be:
I thought sed would replace only the first occurrence but it doesn't seem to do so. What do I have to change to make my code behave this way?