I have the following text:
somegarbageSTARTfirstgroupENDsomeendgarbage
someohtergarbageSTARTsecondgroupENDsomeotherendgarbage
...
I would like to extract firstgroup
using sed.
I tried sed -nr 's/.*START(.*)END.*/\1/p'
, but it doesn't work, it extracts all matches not only the first one.
Best Answer