summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-05-20 15:06:47 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-05-20 15:06:47 +0200
commit5918e020ae87a266a592807fa7c6154521758a44 (patch)
tree080b8af2d4a020984659da9a961283d8abff658f
parenteb5b7969f4d455307f5e3d82807c461ebe18fb86 (diff)
downloadmum-5918e020ae87a266a592807fa7c6154521758a44.tar.gz
Add 'fh' script
This script is designed to filter out unnecessary headers from the mbox index.
-rwxr-xr-xsrc/fh23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/fh b/src/fh
new file mode 100755
index 0000000..0907aba
--- /dev/null
+++ b/src/fh
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -p
+
+# fh -- filter headers
+
+BEGIN {
+ sub header { $_ =~ shift .. not $next =~ /^[ \t]/ }
+ sub skip { $_ = '' }
+}
+
+($_, $next) = ($next, $_);
+skip if header qr/^X-\S+:/i and not header qr/^(
+ X-Mailer
+ | X-Virus-Scanned
+):/x;
+skip if header qr/^(
+ Received
+ | Received-SPF
+ | (DKIM|DomainKey)-Signature
+ | ARC-Message-Signature
+ | IronPort-\S+
+):/x;
+
+END { print $next }