wgrep 怎么隐藏文件名和行号并编辑?

Example file: /tmp/a.txt

04 月 8 日 12:15
long text
long text


4 月 7 日
some text

04 月 6 日
some text

4 月 5 日
some text
some text

使用

  1. M-x grep RET
  2. grep --color -nH --null -Ee "月.*日" a.txt
-*- mode: grep; default-directory: "/tmp/" -*-
Grep started at Wed Apr 20 19:08:51

grep --color -nH --null -Ee "月.*日" a.txt
a.txt:01:04 月 8 日 12:15
a.txt:06:4 月 7 日
a.txt:09:04 月 6 日
a.txt:012:4 月 5 日

Grep finished with 4 matches found at Wed Apr 20 19:08:51

怎么隐藏文件名和行号, 比如a.txt:01:变成下面再编辑?

grep --color -nH --null -Ee "月.*日" a.txt
04 月 8 日 12:15
4 月 7 日
04 月 6 日
4 月 5 日

尝试使用grep, 去掉 -nH 选项:

-*- mode: grep; default-directory: "/tmp/" -*-
Grep started at Wed Apr 20 19:05:36

grep --color --null -Ee "月.*日" a.txt
04 月 8 日 12:15
4 月 7 日
04 月 6 日
4 月 5 日

Grep finished with 4 matches found at Wed Apr 20 19:05:36

然后 使用wgrep尝试编辑, 显示funcall-interactively: Text is read-only

wgrep-change-to-wgrep-mode