User Tools

Site Tools


wiki:renaud17-match

match

Roland Renaud

match and match_or are scripts to allow grep pipelines.

Here are some examples:

% cat animals 
    cat
    dog
    horse
    goat

% cat animals |match hor
    horse

% cat animals |match -o hor go
    horse
    goat


% match -h
    match - a grep pipeline
    Usage: match [-v] {pat}
    Eg: cat file | match str1 str2 str3
         is equivalent to:
        cat file | grep -i str1 | grep -i str2 | grep -i str3
        match -v makes it grep -iv
        match -o calls match_or
           (Enter "match -o -h" for more info)


% match_or -h
    match_or
         code for the or (-o) option for match
        usage: cat file | match_or str1 str2
        usage: match_or str1 str2 <infile
          match_or str1 str2  matches lines that have str1 OR str2
          match_or -i str1 str2     case insensitive match
        eg: cal 11 2004 | match_or 10 17   gives
             7  8  9 10 11 12 13
            14 15 16 17 18 19 20
          match_or -v str1 str2     verbose flag displays the search pattern 
        eg: cal 11 2004 | match_or -v 10 17   gives
            10|17
             7  8  9 10 11 12 13
            14 15 16 17 18 19 20
% 
wiki/renaud17-match.txt · Last modified: 2017/12/16 10:22 by jcnash