Here is the part of 1.html
<table width="100%" cellpadding="2" cellspacing="1">
<tr bgcolor="#FF0000">
<td><center><h3 id="nr_status">FAILED<h3></center></td>
</tr>
</table>
<b>1 tests have been read.</b><br />
<b>1 tests have been executed.</b><br />
<b>0 tests have been ignored.</b><br />
<b>0 tests have suceeded.</b><br />
<b>1 tests have failed.</b><br />
I do not know much about linux but I was exploring StreamEditor, the objective is to set the value FAILED in a variable. So I tried to write a code
sed -n '/<h3 id="nr_status">/,/<\/h3>/p' ~/1.html
The output i got is everything after , not sure why is not being considered as a matching pattern ?
試試看
sed -n '/<h3 id="nr_status">[[:print:]]*<h3>/gm' ~/1.html
推薦一個 RE 的網站
可以先測試看看你設的 RE 找不找得到
Regex 101