13 lines
490 B
Plaintext
13 lines
490 B
Plaintext
|
#!/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 '[^ ]+$'
|