Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 GREPTEXT.TXT 文件中有以下字符串:
APLLE ME APPLE ASA\LE Ale\A\L
我想在上面的字符串中搜索 A\L 模式匹配。我试过逃避 \ as
grep -E A\\L GREPTEST.TXT
但 grep 不返回任何结果。
我应该如何匹配它?
shell 也解释反斜杠。只需将参数放在引号中:
$ echo 'APLLE ME APPLE ASA\LE Ale\A\L' > GREPTEST.TXT $ grep -E 'A\\L' GREPTEST.TXT APLLE ME APPLE ASA\LE Ale\A\L