sed /awk/grep 删除文本文件中除匹配模式之外的所有内容
文件 let pattern.txt
包含
pattern1pattern2pattern3pattern4
路径
嗨,我有一个
行:XXXXXXXXXXXXXXXXXXXXXXXXXXX(XXXXXXXXX,'pattern1 /
另一个文本文件let(complex.txt)
包含路径
2/3/4')XXXXXXXXXXXX
:XXXXXXXXXXXXXXXXXXXXXXXXXXX(XXXXXXXXX,' pattern1/2/3/4')XXXXXXXXXXXX
路径: XXXXXXXXXXXXXXXXXXXXXXXXXX(XXXXXXXXX,'pattern1/2/3/4')XXXXXXXXXX
现在的问题是:::我必须通过将pattern.txt与complex匹配来获取另一个文件filter.txt .txt 将包含一行路径
:pattern1/2/3/4.....
我尝试过...但我没有得到...
有人可以帮忙...谢谢adv...
hi i have a file let pattern.txt
contains
pattern1
pattern2
pattern3
pattern4
another text file let(complex.txt)
contains lines as
path: XXXXXXXXXXXXXXXXXXXXXXXXXX(XXXXXXXXX,'pattern1/2/3/4')XXXXXXXXXXXX
path: XXXXXXXXXXXXXXXXXXXXXXXXXX(XXXXXXXXX,'pattern1/2/3/4')XXXXXXXXXXXX
path: XXXXXXXXXXXXXXXXXXXXXXXXXX(XXXXXXXXX,'pattern1/2/3/4')XXXXXXXXXX
now the prob is :::i have to get another file filter.txt by matching pattern.txt to complex.txt which will contain a line as
path:pattern1/2/3/4.....
i tried...but i am not getting....
can someone help....thanks in adv...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
pattern.txt 包含哪种类型的正则表达式(基本、扩展、perl?)?
如果扩展,只需使用 awk:
上面的代码依赖于“path:”和complex.txt 中的其余行之间的空格。
Which type of regex (Basic, extended, perl?) does pattern.txt contain?
If extended, just use awk:
The above code relies on the space between "path:" and the rest of the line in complex.txt.