Skip to content

Instantly share code, notes, and snippets.

@h2onda
Last active August 29, 2015 14:27
Show Gist options
  • Save h2onda/6a8d208f6eee7058c7ff to your computer and use it in GitHub Desktop.
Save h2onda/6a8d208f6eee7058c7ff to your computer and use it in GitHub Desktop.
parse /proc/net/netstat
#!/usr/bin/env python
import sys
buf=[]
for idx, line in enumerate(sys.stdin.readlines()):
buf.append(line.split())
if idx%2:
for entry in zip(*buf):
print "%s\t%s" % entry
buf=[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment