Below is the out put of the decrypt command.
Decrypt Command:
/usr/bin/gpg --yes --batch --output file.xml --decrypt file.xml.gpg
Output:
gpg: encrypted with 2048-bit RSA key, ID 96301328, created 2014-04-29
"XYZ <xyz@abc.com>"
gpg: encrypted with 2048-bit ELG-E key, ID ECB614CF, created 2002-02-06
"PQR <pqr@abc.com>"
gpg: encrypted with 2048-bit ELG-E key, ID 1EB07C50, created 2014-02-20
"MNP (mnp Data Warehouse file encryption key) <mnp@abc.com>"
gpg: WARNING: message was not integrity protected
My requirement is I need to verify if total 3 keys are present in the encrypted file, the only way i think i know is when i decrypt it and then count the email id's. So how could i get the below email ids from the output i pasted above either by redirecting the output or at the time of decryption itself. After i get this i wanted to go in loop or something to increment a variable to get the count of email id's.
xyz@abc.com
pqr@abc.com
mnp@abc.com
so far i came up with code but still not getting it correctly
cat decrypt_output | grep @ decrypt_output | awk -F"<*" '{print $2}'
xyz@abc.com>"
pqr@abc.com>"
mnp@abc.com>"
appreciate your help.