[ubuntu-uk] SORTED: It's the simple things that baffle me...

David Restall - System Administrator dave at restall.net
Tue Oct 2 16:08:21 BST 2007


> Good to hear it's working, but the message you sent was as an attachment
> "attachment.dat", i'm guessing that wasn't the intention?

Thanks for that Dave.

No - it certainly wasn't.  My fault for being too clever and doing a
direct include of the .exrc file.  The perl command had a couple of
carriage returns (now replaced with \\r) which the mailer detected as a
binary file and so converted it to an attachment.  I have included the
correct text below - lets see if that get through the mailer (it does OK
to my local mailbox).

Thanks for the replies - I knew mutt and elm etc did the work - nail
does it too but it saves the messages as it receives them.  This means
that if I do :-

? s 5 message.txt

message.txt will be quoted-printable.  I was hoping that somebody would
already have experienced this problem and said "Oh yeah, in vim to clean
it up you need to do :!&(*^&**(<CR>.".

Alas no.  My kludge was to save the message, then do :-

sage% nail -f message.txt
? v
:wg message_clean.txt
? q

this created message_clean.txt which didn't have the quoted-printable
in it.

In the past I have used :%s/[=]20/ /g etc. to do the work.

Anyway, the answer is that it's not a built in feature of vim.  I ended
up adding a mapping to my .exrc file :-

map qd mn:%!perl -pe 's/\=([0-9A-Fa-f]{2})/chr(hex($1))/ge; s/\=\n//;'\\r\\r'n

now if I simply type qd in command mode, it converts the whole file to
nice simple unquoted text.

This is what I have been after and unable to find.  The perl code was
found on one of the vim helper sites.  Once I had a better target to
punch into google, it was fairly straightforward.

Several years of irritation, gone in one afternoon :-)


ubuntu/uk-2007-10-02.3.tx              ubuntu-uk DaveWalker at ubuntu.com
| Dave Restall, Computer Nerd, Cyclist, Radio Amateur G4FCU, Bodger          |
| Mob +44 (0) 7973 831245      Skype: dave.restall             Radio: G4FCU  |
| email : dave at restall.net                     Web : Not Ready Yet :-(       |
| Nobody wants constructive criticism.  It's all we can do to put up with    |
| constructive praise.                                                       |

More information about the ubuntu-uk mailing list