<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body><div style="font-family: sans-serif;"><div class="markdown" style="white-space: normal;">
<p dir="auto">On 19 Nov 2025, at 11:57, Glenn Parker via mailmate wrote:</p>
<blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;">
<p dir="auto">On 18 Nov 2025, at 17:21, Bill Cole wrote:</p>
<blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; border-left-color: #999999; color: #999999;">
<p dir="auto">It strikes me as a very trivial "mission." An exported mailbox is just text, so if you have an exported mailbox named 2025.mbox:</p>
<p dir="auto">grep '^Subject: ' 2025.mbox | grep -o ' .*'</p>
<p dir="auto">Will give you all the subjects without the leading "Subject:" tag</p>
</blockquote>
<p dir="auto">A little bit fancier. Strips out the filename and avoids a potential shell error for large directories:</p>
<p dir="auto">cd [message-folder]<br>
find . -name '*.eml' -exec grep -h -m 1 '^Subject: ' {} + | sed 's/Subject: //'</p>
<p dir="auto">Append the following to remove duplicate subjects:<br>
| sort -su</p>
</blockquote>
<p dir="auto">Ah, but this will truncate long subject lines that are continued over multiple lines.</p>
<p dir="auto">Farewell grep, enter sed:</p>
<pre style="margin-left: 15px; margin-right: 15px; padding: 5px; background-color: #F7F7F7; border-radius: 5px 5px 5px 5px; overflow-x: auto; max-width: 90vw;"><code style="margin: 0 0; border-radius: 3px; background-color: #F7F7F7; padding: 0px;">find . -name '*.eml' -exec \
sed -n -e '/^Subject: /!d' \
-e 's/^Subject: //' \
-e ':x' -e 'N' -e 's/\n */ /g' -e 'tx' -e 'P' -e 'b' {} \;
</code></pre>
<p dir="auto">If you have a recent version of sed, i.e. gnu-sed aka “gsed”, this can be written <em>somewhat</em> more legibly as:</p>
<pre style="margin-left: 15px; margin-right: 15px; padding: 5px; background-color: #F7F7F7; border-radius: 5px 5px 5px 5px; overflow-x: auto; max-width: 90vw;"><code style="margin: 0 0; border-radius: 3px; background-color: #F7F7F7; padding: 0px;">find . -name '*.eml' -exec \
gsed -n -e '/^Subject: /!d
s/^Subject: //
:x; N; s/\n / */g; tx; P; b' {} \;
</code></pre>
<p dir="auto">I’m not going to attempt to handle quoted-printable encoding in subject lines. :-)</p>
<p dir="auto">Glenn P. Parker<br>
<a href="mailto:glenn.parker@comcast.net" style="color: #3983C4;">glenn.parker@comcast.net</a></p>
</div>
</div>
</body>
</html>