Unwanted line print in HTML

Rajat Sehgal
Rajat Sehgal used Ask the Experts™
on
Hello Experts,
we have a HTML code like :-
[root@200]# cat SHBODLogs.sh
#!/bin/bash

echo "</pre><br/><br/><u>MRComponents</u><br/><br/>"
echo "<table border=1 style='font-family:Calibri;font-size:11px'><tr><td><b>PID</b></td><td>" | awk '{print $0"<b>Application</b></td><td><b>Socket</b></td></tr>"}';
ps ax | awk '($3 ~ /[RS]/) && ($5 !~ /gnome-terminal/) && ($5 ~ /active/||/BroadCast/||/TServer/||/Broadcast/||/GOCONNECTION/||/POS/||/CM/||/CC/||/SMM/||/DoubleAgent/) && ($5 !~ /awk/) && ($5 !~ /sh/) {print "<tr><td>"$1"</td><td>"$5"</td><td>"$6"&nbsp;&nbsp;"$7"</td></tr>"}'
echo "</table><br/>";

HTML Output :-

HTML OutputHTML Output</pre><br/><br/><u>MRComponents</u><br/><br/>
<table border=1 style='font-family:Calibri;font-size:11px'><tr><td><b>PID</b></td><td><b>Application</b></td><td><b>Socket</b></td></tr>
<tr><td>27359</td><td>./CM</td><td>&nbsp;&nbsp;</td></tr>
<tr><td>27380</td><td>./SMM</td><td>&nbsp;&nbsp;</td></tr>
<tr><td>27392</td><td>./CC</td><td>&nbsp;&nbsp;</td></tr>
<tr><td>27484</td><td>./POS</td><td>&nbsp;&nbsp;</td></tr>
<tr><td>27525</td><td>./CONNECTION</td><td>&nbsp;&nbsp;</td></tr>
<tr><td>27550</td><td>./ACTIVE</td><td>1&nbsp;&nbsp;</td></tr>
<tr><td>27579</td><td>./ACTIVE</td><td>2&nbsp;&nbsp;</td></tr>
<tr><td>27659</td><td>./BroadCast</td><td>1&nbsp;&nbsp;</td></tr>
<tr><td>27696</td><td>./BroadCast</td><td>2&nbsp;&nbsp;</td></tr>
<tr><td>29038</td><td>/usr/local/bin/SrvrHwdInfoBODLogs</td><td>-c&nbsp;&nbsp;#!/bin/bash?#</td></tr>
<tr><td>29052</td><td>/usr/local/bin/SrvrHwdInfoBODLogs</td><td>-c&nbsp;&nbsp;#!/bin/bash?#</td></tr>
</table><br/>

Output attached. My question is why automatically print mention line in output file (SHBODLogs.html), i don't want print this line in output.

<tr><td>29038</td><td>/usr/local/bin/SrvrHwdInfoBODLogs</td><td>-c&nbsp;&nbsp;#!/bin/bash?#</td></tr>
<tr><td>29052</td><td>/usr/local/bin/SrvrHwdInfoBODLogs</td><td>-c&nbsp;&nbsp;#!/bin/bash?#</td></tr>
HTML.jpg
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2014
Top Expert 2015
Commented:
because the ps ax command produced a line something like
29038  ?? S 0:00 /usr/local/bin/SrvrHwdInfoBODLogs -c #!/bin/bash?# CC
If you want to exclude it, you might add a && ($5 !~ /SrvrHwdInfoBODLogs/)
condition to your bash script,
or perhaps when you said
($5 ~ /active/||/BroadCast/||/TServer/||/Broadcast/||/GOCONNECTION/||/POS/||/CM/||/CC/||/SMM/||/DoubleAgent/)
you may have meant to say
($5 ~ /active|BroadCast|TServer|Broadcast|GOCONNECTION|POS|CM|CC|SMM|DoubleAgent/)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial