我知道如何使用grep来做这件事,但现在使用pcregrep。我试过了:
pcregrep -M -1 -rl '."\n' 2012 -name en*.txt但是它不起作用?
基本上,我希望它在文件夹2012中递归地显示名称为en_blahblahblah.txt的所有文件中的前一行和下一行。但是我试过这个命令,它不起作用。我需要使用pcregrep,因为grep不支持换行符。
发布于 2013-01-05 22:43:47
使用-A lines和-B lines选项。
[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从手册页
-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.
https://stackoverflow.com/questions/14172784
复制相似问题