Skip to content

Instantly share code, notes, and snippets.

@alq666
Created May 25, 2016 22:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alq666/3c255e26799a35fb01733eb86ea22001 to your computer and use it in GitHub Desktop.
Save alq666/3c255e26799a35fb01733eb86ea22001 to your computer and use it in GitHub Desktop.
Parse /proc/net/netstat
/TcpExt:/ {
for (i=2; i <= NF; i++) {
if (match($i, /[[:digit:]]+/)) {
values[i] = $i
} else {
keys[i] = $i
}
}
}
END { for (i=1; i <= length(keys); i++) { print keys[i], values[i] }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment