pcregrep递归,显示周围的线

pcregrep递归,显示周围的线,grep,Grep,我知道如何和grep一起做,但现在我知道了。我试过: pcregrep -M -1 -rl '."\n' 2012 -name en*.txt 但它不起作用 基本上,我希望它在文件夹2012中递归地显示所有名为en_blahblahblah.txt的文件的前面一行和下面一行。但我试过那个命令,但没用。 我需要使用pcregrep,因为grep不支持换行。使用-A行和-B行选项 [aman@aman test]$ pcregrep -M -B 2 -A 2 "C\nD" temp And f

我知道如何和grep一起做,但现在我知道了。我试过:

 pcregrep -M -1 -rl '."\n' 2012 -name en*.txt
但它不起作用

基本上,我希望它在文件夹2012中递归地显示所有名为en_blahblahblah.txt的文件的前面一行和下面一行。但我试过那个命令,但没用。
我需要使用pcregrep,因为grep不支持换行。

使用
-A行
-B行
选项

[aman@aman test]$ pcregrep -M -B 2 -A 2 "C\nD" temp 
And failed to add the T and M;      Another called my grammar vile

C
D
                    And criticized my writing style.
Each day I scan each Subject line
从手册页


我尝试了
pcregrep-M-b2-a2'.\n“'11
,但它对me@JOHANNES_NYÅTT我在测试后发布了它。您能提供一些示例输入和预期输出吗?
   -A number, --after-context=number
             Output  number  lines of context after each matching line.


   -B number, --before-context=number
             Output  number lines of context before each matching line.