Best way to get fingerprint programatically

john doe johndoe65534 at mail.com
Wed Dec 18 11:51:07 CET 2019


On 12/18/2019 10:56 AM, 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}'
>

Thanks to both of you, I'll go with the awk version, that way, I can
avoid unneeded pipe redirection! :)


By any chance, could something like the following be implemented?:

$ gpg -K --print-fingerprint-only test


Which would only print the fingerprint to avoid the awk redirection
altogether.

--
John Doe



More information about the Gnupg-users mailing list