- 论坛徽章:
- 0
|
有文本如下:
abc111......Start to do sth......
... ...
<info>......IP:192.168.1.101......
......
xyz999......End the job......
abc222......Start to do sth......
... ...
<info>......IP:192.168.1.102......
......
xyz888......End the job......
abc333......Start to do sth......
... ...
<info>......IP:192.168.1.103......
......
xyz777......End the job......
abc444......Start to do sth......
... ...
<info>......IP:192.168.1.104......
......
xyz666......End the job......
每段文本以Start to do sth开始,以End the job结束,在Start与End间有一段信息以<info>开头,后面有IP地址。
现在,我想根据IP地址来提取文本段落,比如,只提取文本段落中包含<info>... IP:192.168.1.103的文本段落,请问用sed & awk该如何实现?谢谢大家O(∩_∩)O~ |
|