考虑这个文本文件:
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*
正则表达式?
echo "Consider this text file:
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*"
输出:
Run grep "1133*" on this file #Match
This line contains the number 113. #Match
This line contains the number 1133. #Match
This line contains the number 113312. #Match
This line contains the number 113312312. #Match
为什么该行包含113
正数?
正则表达式是否1133*
意味着除了查找包含单词的所有行之外的任何其他内容1133+anything else
?
此示例可在tldp regexp文档页面上找到。