#!/usr/bin/env python
import string, os, sys
dir = '/home/waterye/works/'
files = os.listdir(dir)
for f in files:
if not os.path.isfile(dir+os.sep+f): continue
linecount = 0
fp = open(dir+os.sep+f,'r')
for line in fp:
linecount += 1
fp = open(dir+os.sep+f,'r')
for i,line in enumerate(fp):
if (i==linecount-1 and line.endswith('\n')):
print f
print "--------------------------------"
* bash太难理解,还是用py看上去舒服,虽然不专业,但能完成任务就行