aboutsummaryrefslogtreecommitdiffhomepage
path: root/mutt/message_filter.sh
diff options
context:
space:
mode:
Diffstat (limited to 'mutt/message_filter.sh')
-rwxr-xr-xmutt/message_filter.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/mutt/message_filter.sh b/mutt/message_filter.sh
new file mode 100755
index 0000000..2b4db0e
--- /dev/null
+++ b/mutt/message_filter.sh
@@ -0,0 +1,15 @@
1#!/bin/sh
2
3cd $(dirname $0)
4
5MESSAGE=$(cat)
6
7NEWALIAS=$(echo "${MESSAGE}" | grep ^"From: " | sed s/[\,\"\']//g | awk '{$1=""; if (NF == 3) {print "alias" $0;} else if (NF == 2) {print "alias" $0 $0;} else if (NF > 3) {print "alias", tolower($(NF-1))"-"tolower($2) $0;}}')
8
9if grep -Fxq "$NEWALIAS" alias.topo; then
10 :
11else
12 echo "$NEWALIAS" >> alias.topo
13fi
14
15echo "${MESSAGE}"