mgrep 是一个执行多行 grep 的扩展工具。其设计目的并不是为了替换 grep,而是兼容 grep ,实现对 grep 的扩展。
示例用法:
# Search for lines with "Romeo" in the file shakespeare-romeo_and_juliet: mgrep Romeo shakespeare-romeo_and_juliet # Count the number of include directives in each .cc file: mgrep -c '#include' *.cc # List those files that have "John Doe" in them, regardless of capitalization: mgrep -il 'John Doe' *.cc