Re: Lines beginning with From are not escaped in $record
-BEGIN PGP SIGNED MESSAGE- Hash: SHA512 On Sun, May 29, 2016 at 02:33:14AM -0400, Xu Wang wrote: > Dear all, > > When I send a message, it is appended to a big file called ~/sent. I > would like to get the last email in that big file. I'm trying to > understand the format. I thought I could just get everything starting > with From:. But if there is a line in the body that starts with > 'From:", the F is not escaped like I have seen it before. So my regex > would match that. > > Why is > From: > not escaped for the ~/sent folder and how can I change that? Hello, ~/sent is (per default) a mbox mailbox. See [1] for general documentation. You can't use a regex to parse it. Instead use one of the available mbox parsers out there, e.g [2]. [1]: https://en.wikipedia.org/wiki/Mbox [2]: http://search.cpan.org/~dcoppit/Mail-Mbox-MessageParser-1.5105/lib/Mail/Mbox/MessageParser.pm - -- + privacy is necessary + using gnupg http://gnupg.org + public key id: 0x92FEFDB7E44C32F9 -BEGIN PGP SIGNATURE- Version: GnuPG v1 iQIcBAEBCgAGBQJXSwj/AAoJEJL+/bfkTDL5t0AP/0yDR4QUXfxsLnPA/LB6m8Df RTmNvqmQpcH0WN6LNHYffqMGALvy4w4LNm3LSFzWPENDr0iDr4X26mUgS7FBoB6J GTV4dy9zz92MV9YriojOJwWFIw2fPTrPrYvgunB2MG9SaypVz+mve+LhVb8sboyb YclesfA9HvluxflcRp1TvjAGbNHd+dJfcdQYibAXCnRU2fD78BiJSblXJLilEWYi nVgwcWArYHJlWWQ9NG/a19DhkeqRVbVNBi4XvEsFJv1lQzEYGqZkbgLilBVvV/Hr cV5ziQPet19uFldj26q4gIkFWXDK7JAEp47AaT39eN3MGpNSThwHtNo+saiYrZE/ hzB9Y7VXcZvUzsUFa6jbxFKLUtk77jP8nYklIKYfrnI5RjFMfgToVVjcirjxjpaw kJTtlKfmFThX0Hjw1oK4IiubXWY7oHQdWkXafbma8wmkey3OlKF3AnhwyPE8t0ZE 3F6dQFUikkRFBQC0U1C7ofVhC75kR+20/Q/JG58zdtVXzYsgEzguTphzMJVcpGT4 VqXw2tLsPiBnxIy1zRDf1D0NTkqHci1yLj9y7j4pMQKgCQ+m+X9eG6V4I48lVcxh lhWvwj9uY8R2uI9JJjxY6ZbiH9iXpe2+OWEN9spU/XJ9xsiUY4tVCj3Bp+CGQ/CG 6uNftQumCLFogfP7y7B1 =9MwN -END PGP SIGNATURE-
Re: Lines beginning with From are not escaped in $record
Hello Xu, Le 29.05.2016 08:33, Xu Wang a écrit : > Dear all, > > When I send a message, it is appended to a big file called ~/sent. I > would like to get the last email in that big file. I'm trying to > understand the format. I thought I could just get everything starting > with From:. But if there is a line in the body that starts with > 'From:", the F is not escaped like I have seen it before. So my regex > would match that. If you're looking for the start of messages, you should be searching for lines starting with "From ", including the trailing space. Lines starting with "From:" do not delimit messages in mbox format, but lines starting with "From " in the body of a message should be escaped. Hope this helps. Best Regards, Jeff
Re: Lines beginning with From are not escaped in $record
On Sun, May 29, 2016 at 12:00 PM, Jeff Fisher wrote: > Hello Xu, > > Le 29.05.2016 08:33, Xu Wang a écrit : >> Dear all, >> >> When I send a message, it is appended to a big file called ~/sent. I >> would like to get the last email in that big file. I'm trying to >> understand the format. I thought I could just get everything starting >> with From:. But if there is a line in the body that starts with >> 'From:", the F is not escaped like I have seen it before. So my regex >> would match that. > > If you're looking for the start of messages, you should be searching for > lines starting with "From ", including the trailing space. Lines > starting with "From:" do not delimit messages in mbox format, but lines > starting with "From " in the body of a message should be escaped. > > Hope this helps. > > Best Regards, > Jeff Thank you, Jeff. I indeed missed this important detail! Kind regards, Xu
Re: Lines beginning with From are not escaped in $record
On Sun, May 29, 2016 at 11:21 AM, Simon Ruderich wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA512 > > On Sun, May 29, 2016 at 02:33:14AM -0400, Xu Wang wrote: >> Dear all, >> >> When I send a message, it is appended to a big file called ~/sent. I >> would like to get the last email in that big file. I'm trying to >> understand the format. I thought I could just get everything starting >> with From:. But if there is a line in the body that starts with >> 'From:", the F is not escaped like I have seen it before. So my regex >> would match that. >> >> Why is >> From: >> not escaped for the ~/sent folder and how can I change that? > > Hello, > > ~/sent is (per default) a mbox mailbox. See [1] for general > documentation. > > You can't use a regex to parse it. Instead use one of the > available mbox parsers out there, e.g [2]. > > [1]: https://en.wikipedia.org/wiki/Mbox > [2]: > http://search.cpan.org/~dcoppit/Mail-Mbox-MessageParser-1.5105/lib/Mail/Mbox/MessageParser.pm Interesting! So the term is "From munge". So I guess the format of mbox that mutt uses does not from munge. it must be then than that the format mboxcl2 is being used, which does not from munge and relies on Content-Length:. Can anyone confirm? I searched for mboxcl2 in man muttrc but no instance. Kind regards, Xu