I have a rather complicated grep and awk pattern that I use to get reports out of log files. I works great and I generate a nice light-HTML table that gets emailed to the people who need it.
I would like to add, for each section (each grep) a count of the elements in that section.
grep -c doesn't help because it only returns a count and I don't want to run the grep twice fore every log file for every section.
Everything runs inside a bash script, which also generates the HTML. I can number the rows using CSS, but getting the total count would be great.
The grep/awk is several lines long, and the end of it is the awk that generates the html:
...| awk '{print "<tr><td class=\"rightq\"> \
<a href=\"mailto:admin@example.com?Subject=\
"ENVIRON["DAY"]"%20"$1"&Body="ENVIRON["aBODY"]"\">" \
$1"</a></td><td class=\"rightz\">"$2"</td><td>"$4"</td></tr>"}'
grep
andawk
to begin with?