Skip to content

Instantly share code, notes, and snippets.

@haad
Created May 3, 2012 08:29
Show Gist options
  • Save haad/2584378 to your computer and use it in GitHub Desktop.
Save haad/2584378 to your computer and use it in GitHub Desktop.
Find a server-name in a list of created devices on VIO server and print it's vhost
/usr/ios/cli/ioscli lsmap -all | egrep 'VTD|vhost' | perl -e 'my $old; while (my $line = <STDIN> ) { if ($line =~ /server-name/) { print "$old$line"; next; } $old = $line; }'
/usr/ios/cli/ioscli lsmap -all | egrep 'VTD|vhost' | awk '$0 ~= /server-name/ {print $0" "old;} {old=$0;}'
/usr/ios/cli/ioscli lsmap -all | egrep 'VTD|vhost' | awk '/server-name/{print old"\n "$0;} /vhost/{old=$0;}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment