Best way to get fingerprint programatically

Eric F ericf at disroot.org
Wed Dec 18 13:02:56 CET 2019


On 12/18/19 10:56 , Andrew Gallagher wrote:
> On 18/12/2019 09:32, Werner Koch via Gnupg-users wrote:
>> The  -F:::::: is an interesting hack but Andrew's or my variant works
>> with all AWK implementations:
>>
>>    awk -F: '$1=="fpr" {print $10}' | head -1
> Aha, I forgot about handling multiple results. Note that you don't need
> head if you're already using awk:
>
> 	awk -F: '$1=="fpr" {print $10; exit}'
>
> :-D

This was really interesting. Thanks for that tip (all of you). :)
Updated a key the other day, in a more manual way.

What about updating sub-keys…

$ gpg --with-colons -k 0xlongid | awk -F: '$1=="fpr" {print $10}'
0123…
4567…
8901…
2345…

Any convenient way to automate that, or can I just loop it? …something like:

$ for k in $(gpg --with-colons -k 0xlongid | awk -F: '$1=="fpr" {print $10}'); do \
> gpg --quick-set-expire ${k} <time>; done


 · Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20191218/07cb01d9/attachment.html>


More information about the Gnupg-users mailing list