Autor: Runar Bjarnason Data: A: exim-users Assumpte: [exim] Fixing the exim queue after editing spool files
Have you ever had to make a bulk change to a bunch of header spool files to
remedy, say, messages sent by a buggy mail client?
If you have, you'll have learded, like I did the hard way, that if you edit
spool files, you have to update the character count at the start of each
header entry in the header spool file. I couldn't find an easy way to do
this, so I'm sharing my solution with you in case someone has run into the
same trouble I did.
To automatically repair the count after a bulk change, run your header spool
files through this sed script. It works with header lines up to 999
characters long.
Enjoy!
/^[0-9]\{3\}. / {
s/...//
h
s/.//
s/./x/g
s/xxxxxxxxxx/d/g
s/dddddddddd/h/g
s/hhhhhhhhh/900/
s/hhhhhhhh/800/
s/hhhhhhh/700/
s/hhhhhh/600/
s/hhhhh/500/
s/hhhh/400/
s/hhh/300/
s/hh/200/
s/h/100/
s/^\([^0-9]\)/000\1/
s/00ddddddddd/90/
s/00dddddddd/80/
s/00ddddddd/70/
s/00dddddd/60/
s/00ddddd/50/
s/00dddd/40/
s/00ddd/30/
s/00dd/20/
s/00d/10/
s/0xxxxxxxxx/9/g
s/0xxxxxxxx/8/g
s/0xxxxxxx/7/g
s/0xxxxxx/6/g
s/0xxxxx/5/g
s/0xxxx/4/g
s/0xxx/3/g
s/0xx/2/g
s/0x/1/g
G
s/\r//g
s/\n//g
p
d
}
/^/ {
p
d
}