#!/usr/bin/python import glob #import linecache outfile = open('output_att.txt' , 'w') files = glob.glob('*.sdrf.txt') for file in files: infile = open(file) #count = 0 for line in infile: lineArray = line.rstrip() if not line.startswith('Source Name') : continue #count = count + 1 lineArray = line.split('%s\t') print lineArray[0] output = "%s\t\n"%(lineArray[0]) outfile.write(output) infile.close() outfile.close()