Using this script to pull the command out lines from the text file and sending to email in table format. Need to know how to make the multiple rows (as single command has multiple lines of out) to put in a single cell using awk.
Script used:
tmpfile="/tmp/test.html"
input="/tmp/test.txt"
{
echo '<table border=1 cellspacing=0 cellpadding=3>'
awk 'NR==1 {print "<tr><td>Hostname</td><td>"$0"</td></tr>"}' "$input"
awk 'NR==2,NR==5 {print "<tr><td>IPAddress</td><td>"$0"</td></tr>"}' "$input"
awk 'NR==6{print "<tr><td>Date</td><td>"$0"</td></tr>"}' "$input"
echo '</table>'
} >"$tmpfile"
Text file: cat /tmp/test.txt - lines 2 to 5 has output of a single command.
machinename.domain
ens00: flags=00
inet 00.00.00.00 netmask 00.00.00.0 broadcast
ether 00:00:00:00:00:00 txqueuelen 000 (Ethernet)
RX packets 97 bytes 61809
currentdate
Excepted out in email table format
Hostname machinename.domain
IPAddress ens00: flags=00
inet 00.00.00.00 netmask 00.00.00.0 broadcast
ether 00:00:00:00:00:00 txqueuelen 000 (Ethernet)
RX packets 97 bytes 61809
Date currentdate
Current Output in table format
Hostname machinename.domain
IPAddress ens00: flags=00
IPAddress inet 00.00.00.00 netmask 00.00.00.0 broadcast
IPAddress ether 00:00:00:00:00:00 txqueuelen 000 (Ethernet)
IPAddress RX packets 97 bytes 61809
Date currentdate

IPAddresswith"(c++?" ":"IPAddress")"will produce what you need.PATTERN {ACTION}rules, it only needs to read the input once.