Skip to content

Instantly share code, notes, and snippets.

@ingydotnet
Created March 14, 2012 22:01
Show Gist options
  • Save ingydotnet/2039886 to your computer and use it in GitHub Desktop.
Save ingydotnet/2039886 to your computer and use it in GitHub Desktop.
ifconfig | perl -MXXX -e '$t=do{local$/;<>};@m=split/^(\S+)(?::|\s\s+)/m,$t;shift(@m);for($i=0;$i<@m;$i+=2){next if$m[$i]=~/^(lo|ppp)/;next unless$m[$i+1]=~/inet (addr:)?\d/;print$m[$i];last}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment