Linux egrep命令

时间:2023年06月09日 阅读:164
以下内容仅是站长或网友个人学习笔记、总结和研究收藏。不保证正确性,因使用而带来的风险与本站无关!
淘客轩-衣食住行外卖生活好助手

Linux egrep命令

Linux 命令大全

Linux egrep命令用于在文件内查找指定的字符串。

egrep执行效果与"grep-E"相似,使用的语法及参数可参照grep指令,与grep的不同点在于解读字符串的方法。

egrep是用extended regular expression语法来解读的,而grep则用basic regular expression 语法解读,extended regular expression比basic regular expression的表达更规范。

语法

egrep [范本模式] [文件或目录]

参数说明:

  • [范本模式] :查找的字符串规则。

  • [文件或目录] :查找的目标文件或目录。

在线示例

显示文件中符合条件的字符。例如,查找当前目录下所有文件中包含字符串"Linux"的文件,可以使用如下命令:

egrep Linux *

结果如下所示:

$ egrep Linux * #查找当前目录下包含字符串“Linux”的文件  
testfile:hello Linux! #以下五行为testfile 中包含Linux字符的行  
testfile:Linux is a free Unix-type operating system.  
testfile:This is a Linux testfile!  
testfile:Linux  
testfile:Linux  
testfile1:helLinux! #以下两行为testfile1中含Linux字符的行  
testfile1:This a Linux testfile!  
#以下两行为testfile_2 中包含Linux字符的行  
testfile_2:Linux is a free unix-type opterating system.  
testfile_2:Linux test  
xx00:hello Linux! #xx00包含Linux字符的行  
xx01:Linux is a free Unix-type operating system. #以下三行为xx01包含Linux字符的行  
xx01:This is a Linux testfile!  
xx01:Linux

Linux 命令大全

打赏
标签: Linux egrep命令

本文地址:https://www.momojc.cn/linux/linux-comm-egrep.html

上一篇:Linux ed命令
下一篇:Linux ex命令

关于本站 | 隐私政策 | 免责声明 | 广告合作 | 我要投稿 | 后台管理

CopyRight © 2023-2024 MOMO教程 WWW.MOMOJC.CN , All Rights Reserved.

站长E-mail:378074730@qq.com 网站已运行:  运行时长:0.050 秒

京ICP备20029690号-1京ICP备20029690号-2 京公网安备11011402013892号京公网安备11011402013892号 中国互联网违法和不良信息举报中心 网络违法犯罪举报网站

本网站托管于 腾讯云 .由网站卫士提供网站加速和攻击防御服务 提供CDN加速/防御服务.由zblogcn强力驱动 又拍云提供CDN加速/云存储服务 51la网站统计