[英]Insert results of bash script into html table
I have a script that outputs the last 3 logs of an application. 我有一个脚本,可以输出应用程序的最后3个日志。 I'm looking for this data to be placed into a HTML table that i'm able to send out to my colleagues.
我正在寻找将这些数据放入HTML表中,然后将其发送给我的同事。
Below is the command that I have at the moment but it isn't printing out what I'm looking for. 下面是我目前拥有的命令,但没有打印出我要寻找的命令。
awk -F':' 'BEGIN{print "<table border=1 cellpadding=1 cellspacing=0 bordercolor=BLACK>
<tr>
<td>Environment</td>
<td>Default Shell</td>
</tr>"}{ print "
<tr>
<td>"$success"</td>
<td>"$(NF)"</td>
</tr>"$(NF)"</td></tr>"}END { print "</table>" } ' /var/tmp/pid_test.sh
Any help would be appreciated! 任何帮助,将不胜感激!
try 尝试
{your script that prints output} | awk ...
eg 例如
$ echo -e "a:1\nb:2" |
awk -F: 'BEGIN {print "<table>"}
{print "<tr><td>" $NF "</td></tr>"}
END {print "</table>"}'
gives 给
<table>
<tr><td>1</td></tr>
<tr><td>2</td></tr>
</table>
pipe to 管到
$ script ... | awk ... | mailx -s "test results" test@example.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.