OpenSSH - map aliases in ~/.ssh/config to IP addresses in command line

If I understand that you just want the IP address returned, ie., 192.168.1.1, then this is one (incredibly brittle) way of querying the file from the command line, provided you have the appropriate permissions to read it and your .ssh/config is consistently formatted:

awk '/Host $youralias/ {getline; print $2}' .ssh/config


I am only posting this as I would like to understand how to use awk to do this, but my knowledge is, obviously, quite limited.