微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

用正则expression式grep

考虑这个文本文件

TEST FILE : test #No match #No match Run grep "1133*" on this file #Match #No match This line contains the number 113. #Match This line contains the number 13. #No match This line contains the number 133. #No match This line contains the number 1133. #Match This line contains the number 113312. #Match This line contains the number 1112. #No match This line contains the number 113312312. #Match This line contains no numbers at all. #No match

grep命令如何评估1133*正则expression式?

为什么包含113的行是正面的?

正则expression式1133*意味着除了find所有包含单词1133+anything else ?

如何仅在diff块中search – gvim diff

sed正则expression式 – 当一个模式出现在行中时,在两个双引号之间匹配文本

如何使用bat文件脚本replace文本文件中的文本?

如何使用PowerShell删除与正则expression式匹配的文件夹中的文件

在PowerShell中,如何将环境variables(如$ SystemRoot $)转换为string的一部分?

这个例子在tldp文档页面find。

/ etc / passwd中的行的正则expression式validation

为什么findstr不能正确处理案件(在某些情况下)?

在linux中将日志输出更改为configuration文件

如何在proftpd中使用目录path的正则expression式

.htaccess不能只与Internet Explorer一起工作

你正在考虑一个shell通配符,其中*匹配任何内容。 在正则表达式中 ,a *是一个量词 ,表示紧接在它之前的任何一个“零个或多个”,在这种情况下是3 。

所以你的表达意味着113接着是0或更多3秒。

尝试grep“1133 $”或grep“^ 1133 $”

其中^是行的开始,$是行的结尾

如果你的线路假设3列:aaa 113 bbbb

cat file.txt | awk'{print $ 2}'| grep“^ 1133 $”| wc -l

为了确保你只是看着特定的列

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐