Migrate useful tools from MailWatcherDaemon (old python attempt).

This commit is contained in:
2016-12-23 17:46:37 -08:00
parent a9ed300a03
commit 0f066809b2
2 changed files with 202 additions and 0 deletions

12
cmd/abook-lookup/abook-lookup Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
echo "Searching for $1"
sqlite3 -list -separator ' ' ~/.mutt/abook.db << EOSQL
SELECT s.email, s.name, s.frequency
FROM search s
INNER JOIN
(SELECT email, max(frequency) AS maxfrequency FROM search GROUP BY email) m
ON s.email = m.email AND s.frequency = m.maxfrequency
WHERE s.name
LIKE '%$1%' OR s.email LIKE '%$1%'
ORDER BY s.frequency DESC;
EOSQL