# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression.
sed -E 's/<p.*?style="(.*?)">(.*?)<\\/p>/<div class="myclass" style="$1">$2<\/div>/gms;t' <<< "<div style=\"background-color: #ecedef; padding: 1em 0px;\">
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" style=\"max-width:600px; margin: 0 auto;\">
<tbody>
<tr>
<td>
<div class=\"elementEditable secEdit\" style=\"background-color:#fff;\">
<table class=\"tableMail\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%;max-width:600px;margin: 0 auto;\">
<tbody>
<tr>
<td style=\"width: 25%;\"> </td>
<td class=\"cellLogoCustom\" style=\"padding:30px;text-align:center;position:relative;\">
<img src=\"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSgBBwcHCggKEwoKEygaFhooKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKP/AABEIAAoAGQMBEQACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APqmgAoAKAPzW+LH/JU/GX/Yavf/AEe9AHVf8NB/E/8A6Gb/AMkLX/43QAf8NB/E/wD6Gb/yQtf/AI3QAf8ADQfxP/6Gb/yQtf8A43QB5rq2oXWr6realqEvnXt5M9xPJtC75HYsxwAAMkngDFAH/9k=\" style=\"
max-width: 250px;
\">
</td>
<td style=\"width: 25%;\"> </td>
</tr>
</tbody>
</table>
</div>
<div class=\"elementEditable secEdit\" style=\"color: rgb(255, 255, 255); background-color: rgb(0, 115, 182); font-family: Arial; text-align: center; font-weight: normal; font-style: normal; font-size: 15px;\">
<table class=\"tableMail\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%; max-width:600px; margin: 0 auto;\">
<tbody>
<tr>
<td style=\"padding:30px;text-align:center;\">
<p style=\"font-weight: lighter; text-align: center; font-family: Arial; font-size: 15px; background-color: rgb(0, 115, 182); color: rgb(255, 255, 255);\">
Ordine completato!</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class=\"elementEditable secEdit\" style=\"background: rgb(255, 255, 255); color: rgb(51, 51, 51); font-family: Arial; font-weight: lighter; font-size: 14px;\">
<table class=\"tableMail\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%; max-width:600px; margin: 0 auto;\">
<tbody>
<tr>
<td style=\"padding:40px 30px 40px 30px;\">
<p style=\"font-weight: lighter; color: rgb(51, 51, 51); font-family: Arial; font-size: 14px;\">
Il tuo ordine (#%order_id%) è stato ricevuto ed è in elaborazione.<br>
Il dettaglio dell'ordine è mostrato di seguito perché possa consultarlo:
</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class=\"elementEditable std tabEdit\" style=\"font-family: Arial; background-color: rgb(255, 255, 255); font-size: 13px;\">
<table class=\"tableMail\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%;max-width:600px;margin: 0 auto;\">
<tbody>
<tr style=\"\">
<td style=\"padding: 30px; border-color: rgb(236, 237, 239); color: rgb(51, 51, 51);\">
<table cellspacing=\"0\" cellpadding=\"6\" style=\"width:100%;border: 1px solid #eee;\">
<thead>
<tr>
<th scope=\"col\" style=\"text-align: left; border: 1px solid rgb(236, 237, 239); padding: 12px; color: rgb(51, 51, 51);\">
<p>Prodotto</p>
</th>
<th scope=\"col\" style=\"text-align: left; border: 1px solid rgb(236, 237, 239); padding: 12px; color: rgb(51, 51, 51);\">
<p>Quantità</p>
</th>
<th scope=\"col\" style=\"text-align: left; border: 1px solid rgb(236, 237, 239); padding: 12px; color: rgb(51, 51, 51);\">
<p>Prezzo</p>
</th>
</tr>
</thead>
<tbody>
<!-- product list -->
<tr>
<td style=\"text-align: left; vertical-align: middle; border: 1px solid rgb(236, 237, 239); word-wrap: break-word; padding: 12px; color: rgb(51, 51, 51);\">Prodotto 1</td>
<td style=\"text-align: left; vertical-align: middle; border: 1px solid rgb(236, 237, 239); padding: 12px; color: rgb(51, 51, 51);\">1</td>
<td style=\"text-align: left; vertical-align: middle; border: 1px solid rgb(236, 237, 239); padding: 12px; color: rgb(51, 51, 51);\">EUR 12.50</td>
</tr>
<!-- product list -->
</tbody>
<tfoot>
<tr>
<th scope=\"row\" colspan=\"2\" style=\"text-align: left; border: 1px solid rgb(236, 237, 239); padding: 12px; color: rgb(51, 51, 51);\">
<p>Subtotale:</p>
</th>
<td style=\"text-align: left; border: 1px solid rgb(236, 237, 239); padding: 12px; color: rgb(51, 51, 51);\"><span>%curr% %order_subtotal%</span></td>
</tr>
<tr>
<th scope=\"row\" colspan=\"2\" style=\"text-align: left; border: 1px solid rgb(236, 237, 239); padding: 12px; color: rgb(51, 51, 51);\">
<p>Spedizione:</p>
</th>
<td style=\"text-align: left; border: 1px solid rgb(236, 237, 239); padding: 12px; color: rgb(51, 51, 51);\">
<span>%curr% %order_shipprice%</span>
</td>
</tr>
<tr>
<th scope=\"row\" colspan=\"2\" style=\"text-align: left; border: 1px solid rgb(236, 237, 239); padding: 12px; color: rgb(51, 51, 51);\">
<p>Totale:</p>
</th>
<td style=\"text-align: left; border: 1px solid rgb(236, 237, 239); padding: 12px; color: rgb(51, 51, 51);\">
<span>%curr% %order_total%</span>
</td>
</tr>
</tfoot>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class=\"elementEditable headEdit\">
<table class=\"tableMail\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%; max-width:600px; margin: 0 auto; background: #ccc;\">
<tbody>
<tr style=\"background:#fff;\">
<th style=\"padding:10px 30px 0px 30px; color: #555; font-weight: bolder;text-align:left;\">
<p>Note:</p>
</th>
</tr>
<tr style=\"background:#fff;\">
<td style=\"padding:16px 30px 60px 30px; color: #666; font-weight: lighter; lin-height:1.3;text-align:left;\">
%order_note%
</td>
</tr>
</tbody>
</table>
</div>
<div class=\"elementEditable headEdit\" style=\"background-color: rgb(255, 255, 255); font-size: 13px;\">
<table class=\"tableMail\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%;max-width:600px;margin: 0 auto;\">
<tbody>
<tr style=\"\">
<th style=\"padding: 10px 30px 0px; color: rgb(51, 51, 51); font-weight: bolder;\">
<p>Dettaglio:</p>
</th>
</tr>
<tr style=\"\">
<td style=\"padding: 16px 30px 60px; color: rgb(51, 51, 51); font-weight: lighter; line-height: 1.6;\">
%buyer_name%
<br>
Email: %buyer_email%
<br>
Tel: %buyer_phone%
</td>
</tr>
</tbody>
</table>
</div>
<div class=\"elementEditable std headEdit\" style=\"font-family: Arial; font-size: 13px; background-color: rgb(255, 255, 255);\">
<table class=\"tableMail\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%;max-width:600px;margin: 0 auto;\">
<tbody>
<tr>
<td style=\"color: rgb(51, 51, 51);\">
<table class=\"tableMail\" align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"max-width:300px;margin: 0 auto;\">
<tbody>
<tr style=\"\">
<th style=\"padding: 10px 30px 0px; color: rgb(51, 51, 51); font-weight: bolder;text-align:left;\">
<p>Indirizzo fatturazione:</p>
</th>
</tr>
<tr style=\"\">
<td style=\"padding: 16px 30px 80px; color: rgb(51, 51, 51); font-weight: lighter; line-height: 1.6;\">
%invoice_name%
<br>
%invoice_fiscal%
<br>
%invoice_address% - %invoice_zip%
<br>%invoice_city% (%invoice_state%)
<br>%invoice_country%
<br>
Email: %invoice_email%
<br>
Tel: %invoice_phone%
</td>
</tr>
</tbody>
</table>
<table class=\"tableMail\" align=\"right\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"max-width:300px;margin: 0 auto;\">
<tbody>
<tr style=\"\">
<th style=\"padding: 10px 30px 0px; color: rgb(51, 51, 51); font-weight: bolder;text-align:left;\">
<p>Indirizzo spedizione:</p>
</th>
</tr>
<tr style=\"\">
<td style=\"padding: 16px 30px 80px; font-weight: lighter; line-height: 1.6; color: rgb(51, 51, 51);\">
%shipping_name%
<br>
%shipping_fiscal%
<br>
%shipping_address% - %shipping_zip%
<br>%shipping_city% (%shipping_state%)
<br>%shipping_country%
<br>
Email: %shipping_email%
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<div class=\"elementEditable secEdit\" style=\"background-color: rgb(0, 115, 182); font-size: 12px; color: rgb(255, 255, 255); font-family: Arial; text-align: center; font-weight: lighter; font-style: italic;\">
<table class=\"tableMail\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"width:100%;max-width:600px;margin: 0 auto;\">
<tbody>
<tr style=\"\">
<td style=\"padding:20px 30px;text-align:center;\">
<p style=\"font-weight: lighter; font-family: Arial; text-align: center; font-style: italic;\">%shop_name%</p>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>"
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