rapid7/metasploit-framework — pull request #1320 by kernelsmith (2013-01-16 07:05:33+00:00)
Title: adds a shell-like grep command to msfconsole (RPC friendly I believe)

previously was [see #820], but this PR also enhances the original grep command, adds yard documentation to all the _tabs methods (that's half the commit right there), changes a # XXX comment to a @todo comment, and changes a few refs to the command prompt that should point to the coded default which is Msf::Ui::Console::Driver::DefaultPrompt[and Char] instead of using the string "%undmsf%clr " etc which is the value of the Default anyways

This PR addresses, I hope, scriptjunkie's concern, making it fully RPC client compatible, I'd appreciate any comments and/or testing from @rsmudge & @scriptjunkie etc.
This PR also adds -k for keep and -s for skip as modifiers. -k 6 is useful to maintain table headers w/o grepping them
That and other interesting uses are shown here: https://gist.github.com/4544641
I am writing a spec for this and will submit another PR when I finish it, but it could be some time as @egypt stated that spec'ing command_dispatcher's is a PITA.

usage comparison:
shell grep: grep [options] pattern file
console grep: grep [options] pattern other_cmd [args to other_cmd]
e.g.
grep -i hTTps show payloads
grep -i -A 2 Name.*encoding show advanced