pmatch

From: Date: Fri, 09 Aug 2002 22:55:39 +0000
Subject: pmatch
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5637@lists.php.net to get a copy of this message
Well, I got tired of the limitations of "grep". It always shows the entire line that matches, it doesn't do syntax highlighting, context display, trimming whitespace, etc. So, I wrote a command-line alternative with PHP, and it does wonders for me when grokking smarty templates for variable names, etc. so I opened it to the public. Hope someone finds it useful :-) http://www.phpinsider.com/php/code/pmatch/ pmatch, the PHP regular expression file matcher, version 1.2.0 Monte Ohrt <monte@ispi.net> usage: pmatch [ -CcGHhilnPsTvWX ] 'pattern' [ file ] ...
-C N       : show lines surrounding matched line (context)
-c         : show only line count for each file
-G         : greedy matching
-H         : supress syntax highlighting of matched text
-h         : supress filenames from output
-i         : ignore case
-l         : show only filenames in output
-n         : show line numbers in output
-P         : show only portion of line that matched
-s         : supress error messages about missing or unreadable files
-T         : do not trim whitespace from begin/end of lines
-v         : show lines that do NOT match pattern
-W         : match pattern as a whole word only
-X         : do literal match (no regex)
examples: // find config_file vars, show matches in context pmatch -C 5 "{#.*#}" file1 file2 file3 ... // find template vars, show only text that matched pmatch -P "{\\$.*}" file1 file2 file2 ... Monte

« previous php.smarty.general (#5637) next »