Skip to content

Instantly share code, notes, and snippets.

@smerritt
Created September 27, 2012 21:42
Show Gist options
  • Save smerritt/3796627 to your computer and use it in GitHub Desktop.
Save smerritt/3796627 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#
# Parse the output of lnstat(8) into something perhaps slightly
# human-readable.
#
# Can take input from a file or on stdin.
import sys
lnstat_output = open(sys.argv[1]) if len(sys.argv) >= 2 else sys.stdin
table = [line.split('|') for line in lnstat_output]
for i in xrange(len(table[0])):
print " | ".join([row[i].strip() for row in table])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment