leahneukirchen / mblaze

Unix utilities to deal with Maildir
Other
441 stars 48 forks source link

Match messages without a specific header when "mgrep -v header:match" is used #201

Closed ghost closed 2 years ago

ghost commented 3 years ago

My main usage is to pipe messages through mlist ... |magrep -v to:addr |magrep -v cc:addr.

I'm not sure the patch is complete, but still...

leahneukirchen commented 3 years ago

I need to think about whether this is a good semantics change.

ghost commented 3 years ago

Maybe because I'm new to mblaze, I think I'll be fine without magrep when I search headers. Extracting the headers with mhdr, prefixed with the filename (-H), and piping through |grep | awk'{print $1}'|sort -u should be enough.

Duncaen commented 3 years ago

If you need even more complex searches, mpick would also be an alternative.

mpick -t '"to".addr != "mail@duncano.de" && "cc".addr != "mail@duncano.de"'
ghost commented 3 years ago

I need to think about whether this is a good semantics change.

It was surprising for me to find that magrep -v header:pattern doesn't match messages if that header is missing. If this was your intention, maybe you should leave it as it is. I see that I have at least two methods for my use-case :)