List file's encryption keys with --with-colons?

schalox schalox at
Fri Apr 25 14:28:22 CEST 2014


When using --list-keys, you can do this:
gpg --list-keys --with-colons "${GPG_RECIPIENTS[@]}" |
    grep '^sub:' | cut -d ':' -f 5 | sort -u

Can you do the same with --list-only to get the (long versions of)
encryption keys in a colon-separated output?

Currently we're using this:
gpg -v --list-only --keyid-format long "$file" 2>&1 |
    cut -d ' ' -f 5 | sort -u

We know of FAQ's method[0], but we'd like to know if there's a better
way to do this.


More information about the Gnupg-users mailing list