Perl one-liner for parsing host names from ssh config file
I would use something like

perl -lane '@h{@F[1..$#F]}=()if/^Host\b/;END{$,=" ";print keys %h}' -- file


or

perl -lane '@h{ @F[ 1 .. $#F ] } = () if /^Host\b/;
            END {
                $, = " ";
                print keys %h;
            }' -- file



-l removes newlines from input and adds them to prints
-n runs the code for each line of the input
-a splits each line on whitespace into the @F array
the hash %h is populated by all the non-whitepsace strings following Host
at the end, all the keys are printed separated by space