Skip to content

Instantly share code, notes, and snippets.

@0xAhmed
Forked from smerritt/parse-lnstat.py
Created October 18, 2012 16:55
Show Gist options
  • Save 0xAhmed/3913250 to your computer and use it in GitHub Desktop.
Save 0xAhmed/3913250 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