#!/usr/bin/python
import sys
import os.path
import os
if len(sys.argv) < 2:
print('Usage: %s file_name' % sys.argv[0])
fp = open(sys.argv[1],'r')
#size = os.path.getsize(sys.argv[1])
fp.seek(-1, 2)
try:
data = ''
data = fp.read(1)
while True:
fp.seek(-2, 1)
t = fp.read(1)
if t == '\n':
print data
data = ''
else:
data = t+data
except Exception, e:
print data
sys.exit(0)
print data
Diff to Previous Revision
--- revision 1 2011-05-17 10:21:03
+++ revision 2 2011-05-18 12:54:15
@@ -3,7 +3,7 @@
import os.path
import os
-if len(sys.argv < 2):
+if len(sys.argv) < 2:
print('Usage: %s file_name' % sys.argv[0])
fp = open(sys.argv[1],'r')