欢迎各位兄弟 发布技术文章
这里的技术是共享的
在 macOS 中,可以使用 -F 或 --fixed-strings 参数来禁用 grep 命令的正则表达式功能,仅匹配固定的文本字符串。
-F
--fixed-strings
grep
例如,要在文件中搜索字符串 "hello world",可以使用以下命令:
shellgrep -F "hello world" filename
shell
grep -F "hello world" filename
这样将只匹配文件中精确的 "hello world" 字符串,而不会使用正则表达式进行模式匹配。