Why can't i match the pattern in this case?
<tr>$
<td nowrap valign="top" class="table_1row"><a name="d071301" id="d071301"></a>13-Jul-2011</td>$
i wo开发者_如何学编程uld like to match tr>$ <td nowrap valign
, but when i try
grep -c "tr>\n<td nowrap valign" test.html
then i also tried
grep -c "tr>\n\s*<td nowrap valign" test.html
both of them find nothing. What error here?
One more question, can i add a character ^M into a html file by using sed???thanks
grep
only does single line searches. Another source
To recap on some comments, sed
does multiline searches and you can address the carriage return in sed syntax with \r
To add your control character, add the actual character: Type Ctrl+V, Ctrl+M.
sed will treat the control character just like a normal character.
精彩评论