# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/<slot-configuration slot-id="refinebar-slot-content" context="category" context-id="(.*)" configuration-id="(.*?)"( default="(?:.*)?")? assigned-to-site="(.*)">\s*<template>(.*)<\\/template>\s*<enabled-flag>(.*)<\\/enabled-flag>\s*<content>\s*<content-assets>(\s*<content-asset content-id=".*"\\/>)*\s*<content-asset content-id="(seo-.*)"\\/>\s*(?:<content-asset content-id=".*"\\/>\s*)*<\\/content-assets>\s*<\\/content>(\s*<customer-groups>(?:\s*<customer-group group-id=".*"\\/>)+\s*<\\/customer-groups>|.*)?\s*<\\/slot-configuration>/$0 <slot-configuration slot-id="mobile-refinebar-slot-content" context="category" context-id="$1" configuration-id="$2-mobile"$3 assigned-to-site="$4"> <template>$5<\/template> <enabled-flag>$6<\/enabled-flag> <content> <content-assets> <content-asset content-id="$8"\/> <\/content-assets> <\/content>$9 <\/slot-configuration>/gm;t' <<< " <slot-configuration slot-id=\"refinebar-slot-content\" context=\"category\" context-id=\"sport-garcon\" configuration-id=\"seo-boutique-sport-garcon-2\" default=\"true\" assigned-to-site=\"true\">
<template>slots/content/htmljustcontent.isml</template>
<enabled-flag>true</enabled-flag>
<content>
<content-assets>
<content-asset content-id=\"seo-boutique-bbf-2\"/>
<content-asset content-id=\"account-menu-content-management\"/>
<content-asset content-id=\"seo-boutique-sport-garcon\"/>
</content-assets>
</content>
</slot-configuration> "
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for SED, please visit: https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html