How to eliminate attachments in TW?

10 views
Skip to first unread message

Alexandru Cioba

unread,
Nov 27, 2017, 12:34:11 PM11/27/17
to TextWrangler Talk
Hi to all,
I want to get rid of attachemnts included in text files, such as:

Content-Type: image/jpeg; name="IMG_7552.JPG"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="IMG_7552.JPG"

/9j/4TtTRXhpZgAASUkqAAgAAAAJAA8BAgAGAAAAegAAABABAgAXAAAAgAAA
ABIBAwABAAAAAQAAABoBBQABAAAAoAAAABsBBQABAAAAqAAAACgBAwABAAAA
AgAAADIBAgAUAAAAsAAAABMCAwABAAAAAgAAAGmHBAABAAAAxAAAALQWAABD
YW5vbgBDYW5vbiBFT1MgNDAwRCBESUdJVEFMAAAAAAAAAAAAAEgAAAABAAAA
SAAAAAEAAAAyMDA5OjA3OjA5IDIyOjM0OjU2ABwAmoIFAAEAAAAaAgAAnYIF

Is any method to do that? Thank you

Thomas Fischer

unread,
Nov 27, 2017, 1:30:41 PM11/27/17
to textwr...@googlegroups.com
Hello Alexandru,

there are really no „attachments to text files“, I suppose you have an email and are looking at the text version of it.

Basically, there are ways to cut pieces from a file, in your case it might start with
> Content-Type: image/jpeg;
The question is, where will it end? Do you have a unique string that comes after the base64 block that is easily recognizable?
Then something like

Find Content-Type: image/jpeg;(?s).+?<end marker>
Replace with empty
using grep

might do the job.

Else you may rely on the length of the lines, but this is obviously error-prone:

Find (^.{60}\n)+
Replace with empty
using grep

leaving the content info strings intact.

Cheers
Thomas
> --
> This is the TextWrangler Talk public discussion group.
> If you have a feature request or would like to report a problem,
> please email "sup...@barebones.com" instead of posting here.
> ---
> You received this message because you are subscribed to the Google Groups "TextWrangler Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to textwrangler...@googlegroups.com.

Alexandru Cioba

unread,
Nov 28, 2017, 6:30:21 AM11/28/17
to TextWrangler Talk
Thank you!
The second works well for me :)
Reply all
Reply to author
Forward
0 new messages