Re: Grepping for emails problem.
A relatively easy solution might be to break the grep appart and not use regular expressions for the second component: grepmail -h '^Message-[Ii][Dd]' | grep -F "$MSGID" Michael
On 07/04/2021 06.51, Michael Hamilton wrote:
A relatively easy solution might be to break the grep appart and not use regular expressions for the second component:
grepmail -h '^Message-[Ii][Dd]' | grep -F "$MSGID"
No, that doesn't work. What "grepmail" does is search inside a mailbox archive in mbox format with possibly many thousands of emails, and produce a target mailbox with only a few selected mails. And I use it to obtain the full single email contained in the archive that has a certain Message-ID. Thus, the first command above would hit every email, and the second would only produce a line, which is not what's wanted. -- Cheers / Saludos, Carlos E. R. (from 15.2 x86_64 at Telcontar)
On 2021-04-07 08:08, Carlos E. R. wrote:
Thus, the first command above would hit every email, and the second would only produce a line, which is not what's wanted.
Just a thought. Couldn't you convert the mbox to maildir and process every single mail as a file? And if you need to go back to mbox from maildir just convert your grepped mail back to mbox. This way you don't have to rely on grepmails shortcomings. -- /bengan
On 07/04/2021 09.32, Bengt Gördén wrote:
On 2021-04-07 08:08, Carlos E. R. wrote:
Thus, the first command above would hit every email, and the second would only produce a line, which is not what's wanted.
Just a thought. Couldn't you convert the mbox to maildir and process every single mail as a file? And if you need to go back to mbox from maildir just convert your grepped mail back to mbox. This way you don't have to rely on grepmails shortcomings.
Thanks, but the job is already processed :-) -- Cheers / Saludos, Carlos E. R. (from 15.2 x86_64 at Telcontar)
participants (3)
-
Bengt Gördén
-
Carlos E. R.
-
Michael Hamilton