Skip to content

Instantly share code, notes, and snippets.

@lukaszb
Created May 9, 2013 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukaszb/5549961 to your computer and use it in GitHub Desktop.
Save lukaszb/5549961 to your computer and use it in GitHub Desktop.
Use it with
#!/usr/bin/env python
"""
Use it as::
ls -l | python linecat.py
or::
python linecat.py < file.txt
"""
import fileinput
input = fileinput.input()
for i, line in enumerate(input, 1):
print "{:>3} | {}".format(i, line.rstrip('\n'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment