Page 1 of 1

Grep filter and countMatches

Posted: Mon Jun 04, 2012 12:57 pm
by rconn
Hi Simon:

Not sure if this is confusion in the documentation or something wrong with the Grep filter:

Using the TextPipe Engine, I'm calling addGrepFilter with "countMatches=1". The help says:

countMatches - true to only output a count of the number of matches, default False

But what it actually does is print out all of the matching (or non-matching, depending on "type") lines, and then print the countMatches result at the end.

Is this WAD? If so, is there a way to print JUST the countMatches value without all the matching/nonmatching lines?

Re: Grep filter and countMatches

Posted: Thu Jun 21, 2012 3:40 am
by DataMystic Support
Hi Rex,

It sounds like you are using a type of 0 or 1, instead of a type of 3 or 4:

Code: Select all

type:
0 Restrict lines matching
1 Restrict lines NOT matching
2 Extract matches
3 Extract matching lines (grep)
4 Extract non-matching lines (inverse grep)
5 Remove matching lines
6 Remove non-matching lines
Types 0 and 1 will return every single match to the filters inside the restriction, which then modify those matching lines further.

Types 3 and 4 will remove all non-matching text.