Scott Moseman | 13 Aug 2008 22:53
Picon

Which grep match?

Let's start from this very basic grep recipe...

* ? formail -x Subject: | fgrep -is -f /etc/procmail/subjects.txt

I will know it matched an entry in the file, but I will not know
*which* entry (from subjects.txt) was matched.  Is there an *easy* way
to process this type of query *and* get the match output?  I suppose
in a worst case I could pipe to a script and go through the
subjects.txt file line by line looking for a match, but there must be
an easier way?

My goal is that I desire to start collecting a "hit count" on the
matches, so I see which ones are matched often and which ones are
rarely matched, if ever.

Thanks,
Scott

Gmane