I have been working on a script that collects data about servers and formats them into a nice html email report. I have been using sed to replace values in a html template so far and that has been mostly okay, but I have come across a situation where I need to insert a multiple line block of html based on variables an arbitrary number of times. I'm not sure quite how to do this, as sed doesn't seem to play too nice with multiple lines? Maybe there's a way with perl or awk that I hadn't considered.
Here's an example where I'd need to insert 0-n table blocks into an existing template based on however many files were there
for f in $files
<tr class="details"> <td> f.$DATE </td> <td> f.$APPLIANCE </td> <td> f.$HOST </td> <td> f.$MDL </td> </tr>