import os,sys,time file = open('svnlog') revList = [] tempList = [] linen = 1 for line in file: if (line.startswith("r")) : svnNumber = line.split('|')[0] tempList.append(svnNumber) if line.find('APP-80') != -1 : tempList.append(line) revList.append(tempList) tempList = [] linen +=1 svnRevList=[] for i in range(len(revList)): svnRev = "".join(revList[i][-2:-1]) svnRevList.append(svnRev.strip()[1:]) #for j in range(len(revList[i])): # print revList[i][j] print svnRevList svnRevList.sort() for i in range(len(svnRevList)): print svnRevList[i] file.close() ~