What is the difference between grep -e and grep -E?

grep -e is suitable for simple regular expressions, such as searching for specific keywords in a string. For example:

grep -e 'hello' file.txt
# 将会在文件file.txt中搜索出所有包含“hello”这个关键词的行。

grep -E works with complex regular expressions that can match text using multiple selections, repetitions, and subexpressions. For example:

grep -E '(foo|bar)baz' file.txt
#会在文件file.txt中搜索出所有包含“foobaz”或者 “barbaz” 的行。

Supongo que te gusta

Origin blog.csdn.net/dgwxligg/article/details/129189848
Recomendado
Clasificación