更改grep命令的分隔符 [英] Change delimiter of grep command

查看:257
本文介绍了更改grep命令的分隔符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 grep 来检测< a href =xxxx>这里的东西< / a>

当输入中的两行分割链接时,这不起作用。我想grep来检查,直到它检测到< / a> ,但现在它只是将输入转换为grep,直到它检测到一个新行。

I am using grep to detect <a href="xxxx"> something here </a>
This is not working when the link is split on two lines in the input. I want to grep to check till it detects a </a> but right now it only is taking the input into grep till it detects a new line.

因此,如果输入像< a href =xxxx>这里的东西< / a> 它可以工作,但是如果输入就像

So if input is like <a href="xxxx"> something here </a> it works, but if input is like

<a href="xxxx">

something here /a>    

,那么它不会。
任何解决方案?

, then it doesn't. Any solutions?

推荐答案

我会使用awk而不是grep。这应该是可行的:

I'd use awk rather than grep. This should work:

awk'/ a href =xxxx> /,/ \ / a> /'filename

这篇关于更改grep命令的分隔符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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