On 4-Jan-2011, at 09:14, [email protected] wrote:
>
> Can BBEdit, on its own or using Unix command-line operations, do
> this?
Yes, but there are better tools, specifically MIME-aware tools. Or even perl.
A grep for lines that are 76 characters long and contain no spaces or
punctuation would match the actual encoded attachments, but grabbing the MIME
boundaries is trickier.
^[+a-z\/0-9]{76}$
This will match all the lines in the attachment except the last one.
> I suppose the solution is something like this: many of the text
> strings begin with the same set of three or four characters. I want
> the BBEdit script or command to search for these sets, then delete
> them and everything following until it reaches the string "--Apple-
> Mail."
That way madness lies. Either get a MIME aware tool that will strip the MIME
attachments from the mbox file, or simply strip the encoded lines and don't
worry about the boundary lines (or at least deal with those in a second step).
your attachment will look something like this:
--Apple-Mail-2-649664677
Content-Disposition: inline;
filename*=iso-8859-1''GMT%%A0Receipt.pdf
Content-Type: application/pdf;
name="=?iso-8859-1?Q?GMT=A0Receipt.pdf?="
Content-Transfer-Encoding: base64
JVZERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9G
bGF0ZURlY29kZSA+PgpddHJlYW0KeAHNW1lz3LgRfsevQLn8QLkyIx7g5afIWtlxsutL46Qq2TzI
knVsNBrZI23if5+vG2gQIClrOONUxXYNSRBEd3994vAX/V5/0Vmj23peFZXRZV7Ym6qu5gWa9NfP
+m/6Ru8frjN9utYZ/12ffvcjhY/Ox9uDhj3X+68w6MVap/MqLdo8q8buFBFr56Y0ZalNwXeVXuo8
BUT, that --Apple-Mail line will appear multiple times in the email (In one
message with a single attachment, "--Apple-Mail-" appeared 8 times), so you
cannot just willy-nilly delete everything up to one of those line.
--
Elves are wonderful. They provoke wonder. Elves are marvellous. They
cause marvels. Elves are fantastic. They create fantasies. Elves are
glamorous. They project glamour. Elves are enchanting. They weave
enchantment. Elves are terrific. They beget terror.
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>