Rob van der Woude's Scripting Pages

Help text for RxGrep.cs

(view help text of RxGrep.cs as plain text)

RxGrep,  Version 2.02
Multi-line FindStr/Grep like tool

Usage:   RXGREP  filename  pattern  [ /F:size ]  [ /I ]  [ /S:nn ]  [ /T:nn ]
or:      command  |  RXGREP  pattern  [ /F:size ]  [ /I ]  [ /S:nn ]  [ /T:nn ]

Where:   filename   is the file to be filtered
         command    is the command whose standard output is to be filtered
         pattern    is the search pattern (regular expression)
         /F:bytes   searches only the first number of bytes
         /I         makes the search case Insensitive
         /S:nn      Skip the first nn matches
         /T:nn      Take only nn matches

Example: ROBOCOPY D:\sourcedir E:\targetdir /NP /MIR |
         RXGREP "\s+\d+\s+D:\\sourcedir\\[^\n\r]*\r\n([^\n\r\\]+\r\n)+"
         (to be read as a single command line) will return something like:
                         125    D:\sourcedir\subdir\
            New File                 342        brandnewfile.ext
            Newer                  4.06m        updatedfile.ext
          *EXTRA File              2.40m        deletedfile.ext

Note:    If /F:bytes is used and a file is specified, only the first bytes
         of that file will be read; if the input is redirected, it is read
         entirely, and will then be chopped to the specified number of bytes
         before being searched.

Credits: Check for redirection by Hans Passant on
         Array Slice extension by Sam Allen

Written by Rob van der Woude

page last uploaded: 2017-03-25, 21:31