为什么我不能在这种情况下,模式匹配? [英] Why can't i match the pattern in this case?

查看:167
本文介绍了为什么我不能在这种情况下,模式匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <tr>$
                                  <td nowrap valign="top" class="table_1row"><a name="d071301" id="d071301"></a>13-Jul-2011</td>$

我想匹配 TR&GT; $&LT; TD VALIGN N​​OWRAP ,但是当我尝试

grep -c "tr>\n<td nowrap valign" test.html

然后我也试过

grep -c "tr>\n\s*<td nowrap valign" test.html

他们都找到什么。有什么错误吗?

both of them find nothing. What error here?

还有一个问题,我可以通过使用SED ???谢谢添加字符^ M转换成HTML文件

One more question, can i add a character ^M into a html file by using sed???thanks

推荐答案

的grep 只做一行搜索。 <一href=\"http://stackoverflow.com/questions/3717772/regex-grep-for-multi-line-search-needed/3717838#3717838\">Another源

要回顾一下上的一些评论, SED 做多行搜索,可以解决与 \\ r

To recap on some comments, sed does multiline searches and you can address the carriage return in sed syntax with \r

这篇关于为什么我不能在这种情况下,模式匹配?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆