</tr>
<tr class='htmllist_tr' style="background-color:yellow" ><td class='htmllist_td' >INDX01</td>
<td class='htmllist_td_nbr' >964.87</td>
<td class='htmllist_td_nbr' >95.13</td>
<td class='htmllist_td' >NehaA9.86</td>
</tr>
<tr class='htmllist_tr' ><td class='htmllist_td' >UNDOTBS1</td>
<td class='htmllist_td_nbr' >156.25</td>
<td class='htmllist_td_nbr' >8</td>
<td class='htmllist_td' >NehaA5.12</td>
</tr>
想<tr>
和</tr>
标签之间找到NehaA然后更改匹配模式和HTML标签替换
`<tr class='htmllist_tr'>`
或
<tr class='htmllist_tr' style="background-color:yellow">
到
`<tr class='htmllist_tr' style="background-color:red">` *
试过这种
sed -e "/NehaA/ s/\'<tr class='htmllist_tr'>\'/\'<tr class='htmllist_tr' style="background-color:red">\'/ ;" 2932_TABLE2.txt
没有工作,请帮助
在AWK做它/ sed的是不是最好的主意。你为什么不使用Python +美丽的汤?在perl中,你可以使用(我认为,我没有使用它)HTML :: Parser。 –
HTML与XML一样是结构化数据。您不能将其视为普通的文本文件。有[可用的许多模块](http://search.cpan.org/search?m=module&q=html)将解析您的HTML并允许您修改它。 – Borodin