ANONYMOUS CVS: (leave password empty)
    cvs -d login
    cvs -d checkout pmatch



    pmatch - a grep-like command-line utility with enhancements


    Monte Ohrt <monte [AT] ohrt [DOT] com>


    1.5.3 - January 21, 2004


    // search for string "foo" in *.txt files
    pmatch "foo" *.txt
    // search for {$...} in *.tpl files,
    // show two lines above and below matches
    pmatch -C 2 "{\\$.*}" *.tpl
    // search for {$...} in *.tpl files,
    // only show file name,
    // show 5 characters before and after match
    pmatch -F -P 5 "{\\$.*}" *.tpl

    pmatch is a unix command-line utility that offers many enhanced
    features over grep. Some of these enhancements include syntax
    highlighting, trimming whitespace off the match for easier viewing,
    showing only the portion of the line that matched, show lines
    surrounding the match to see it in context, etc.


1) Be sure the command-line version of PHP is in your path,
   such as /usr/local/bin/php

2) Edit the pmatch script, make sure the path to php is
   correct (first line)

3) Copy the pmatch script to your bin directory:
   $> cp pmatch /usr/local/bin

4) Make the script executable:
   $> chmod 555 /usr/local/bin/pmatch

5) run the script, you should get usage instructions:
   $> pmatch


usage: pmatch [ -CcFGHhilnPsTvWX ] 'pattern' [ file ] ...
-C N       : show N lines above and below matched line
-c         : show only line count for each file
-F         : hide file path
-G         : greedy matching
-H         : disable syntax highlighting
-h         : supress filenames
-i         : ignore case
-l         : show only filenames
-n         : show line numbers
-P [N]     : show only first match, with N surrounding chars
-M         : show only matching chars
-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)


View Monte's other projects