正则表达式从文本文件中删除重复的段落

时间:2013-12-02 05:10:37

标签: regex

我编写了一个期望脚本来登录几个路由并运行sh inv命令,但输出也是 包含以下内容:

********************************* Access Warning!! ***********************************
*                                                                                    *
* This computer system, its network and data contained therein is the property of    *
* the <Company name>. Access to this computer and network is restricted              *
* to persons and programs authorised by the Group only. Access by others is          *
* prohibited and unauthorised, and is wrongful under law. Do not proceed if you      *
* are not authorised. Any unauthorised access will be prosecuted to the fullest      *
* extent of the law.                                                                 *
*                                                                                    *
**************************************************************************************

我是否可以使用RegEx从文本文件中删除上述重新出现的段落?

1 个答案:

答案 0 :(得分:0)

this answer开始,您可以使用Linux命令sed

从那里,上面的文本可以与正则表达式匹配:

\*{33} Access Warning!! \*{35}.*\*{86}

Regular expression visualization