#!/usr/bin/python import re, os, sys f = open(sys.argv[1],'r') w = open(os.getcwd()+'/chi2','w') inp = f.read() f.close() moves = re.findall(r'Time\sused\s+(\d+\.\d+)',inp) chi2 = re.findall(r'Chi\*\*2\/dof\s+(\d+\.\d*\w*\+*\d*)',inp) n=0 for each in moves: if n < len(chi2): w.write(each + ' ' + chi2[n] + '\n') n+=1 w.close() os.system('xmgrace '+ os.getcwd() + '/chi2')