summary refs log tree commit diff
path: root/contrib/mfillmid
blob: d69a2e405cdddc9f2475bb9faf64663d71cfd81d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh
# mfillmid - fill in files for message-ids (via mairix)

exec awk '
function q(a) { gsub("\\47", "\47\\\47\47", a); return "\47"a"\47" }
/<..*>/ {
	match($0, "<..*>")
	mid = substr($0, RSTART+1, RLENGTH-2)
	if ("mairix -r m:" q(mid) | getline file) {
		print substr($0, 0, RSTART-1) file
		next
	}
}
{ print }'