summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmutt-search-address-book12
1 files changed, 12 insertions, 0 deletions
diff --git a/mutt-search-address-book b/mutt-search-address-book
new file mode 100755
index 0000000..bc5352a
--- /dev/null
+++ b/mutt-search-address-book
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+pattern=$1
+
+echo 'searching for '$pattern' ...'
+
+get_matches() {
+ gpg --list-keys --with-colons | grep '^uid:' | cut -d: -f10 | sed -rn 's#(.*) <([^>]+).*#\2\t\1\tgpg-mail#p' | grep -F "$pattern"
+ khard email --parsable --remove-first-line --search-in-source-files "$pattern"
+}
+
+get_matches | sort -u