shell-utils/app/contacts

13 lines
490 B
Plaintext
Raw Normal View History

2023-07-15 19:21:25 +00:00
#!/usr/bin/env zsh
addressbook="/home/gmgauthier/.local/share/addrbook/contacts.txt"
## Simple record retrieval by any known value
#awk 'BEGIN { RS = "<->" } /'$*'/' $addressbook
## Get record by search for substring in email
#awk 'BEGIN { RS = "<->"; FS = "email: " } ($2 ~ "'${*}'") { print $0 }' $addressbook
## Get email addresses in a specific contact class
awk 'BEGIN { RS = "<->"; FS = "category: " } ($2 ~ "'${1}'") { print }' $addressbook | grep '^email:' | egrep -o '[^ ]+$'