Grep filter and countMatches

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
rconn
Posts: 32
Joined: Wed Feb 29, 2012 11:56 pm

Grep filter and countMatches

Post 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?
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Grep filter and countMatches

Post 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.
Post Reply