I'm looking to display just the email address in the /var/log/secure file. The email goes into a variable, so just grepping for lines won't work.
I know how to string together sed commands, but is there a cleaner way?
I could even scrap the idea altogether, if there is a cleaner way to get ssh key comment emails. I'm looking to find out which email comment, on the clients ssh key, was used to login. So far I have been using something like this..
ssh root@localhost "sleep 1 ; tail -1 /var/log/secure | ..."
I hope there is a better way, or at least a clean way to display just the email.