Don and Derek,
Thanks so much for the assistance. I really appreciate the fact that your help will allow me to change mail clients again, (which is why I'm doing the conversion to mbox finally), and not lose the last couple of years of emails.
For an initial quick response, the files are email messages stored individually as separate files in a maildir hierarchy. While they are appended with the extension .eml usually in a Microsoft windows environment, in my hierarchy they're stored as files with filenames that are a string of numbers with no extension.
When I edited the first find commands that Derek suggested to search for all files, (removed the EeMmLl), it did indeed locate, and then later count, all affected files. Additionally while I originally thought I should remove the > character from the actual From header line, I found out that the conversion program works whether the > character is there or not. The important part is the removal of the first From line, (mbox postmark), when it exists. I appreciate your suggestion though of removing the > character from the actual From line, and will look to use that as well.
Finally, Rudi, the example headers I posted are pulled from two separate EML files in my hierarchy. They're not in an mbox file, (which is basically a single file with contains a number of email messages).
Thanks all,
Jason
---------- Post updated at 02:08 PM ---------- Previous update was at 08:58 AM ----------
Thanks again Don and Derek. I ended up using Don's shell script, and editing the find filename parameters to;
#!/bin/bash
bfc=0
find . -type f -name '*' | while read -r file
do read -r f1 f2 rest < "$file"
if [ "$f1" = "From" ] && [ "$f2" = "-" ]
then # Bad file found...
bfc=$((bfc + 1))
printf 'bad file #%d: %s\n\tFrom - %s\n' $bfc "$file" "$rest"
ed -s "$file" <<-EOF
1d
w
q
EOF
fi
done
I ran it from the top level maildir subdirectory, and it worked perfectly, finding every file with an mbox postmark in my maildir hierarchy, displaying the filename, counting the file, and then deleting the mbox postmark from the affected file.
Total 'bad' eml files discovered, and cleaned of mbox postmark; 14,473
Thanks very much to both of you!
Jason