From Rahul Jha, 2 Months ago, written in Python.
Embed
  1. import glob
  2.  
  3. first_row = []
  4. second_row = []
  5. third_row = []
  6.  
  7. req_files = glob.glob('*.dat')
  8. filename = 'atul.csv'
  9.  
  10. for r in req_files:
  11.     with open(r) as f:
  12.         lines = f.readlines()
  13.         first_row.append("%s, %s" % (lines[252].split()[1], lines[252].split()[3]))
  14.         second_row.append("%s, %s" % (lines[253].split()[1], lines[253].split()[3]))
  15.         third_row.append("%s, %s" % (lines[254].split()[1], lines[254].split()[3]))
  16.  
  17. with open(filename, 'w') as csvfile:
  18.     csvfile.write(",".join(first_row))
  19.     csvfile.write("\n")
  20.     csvfile.write(",".join(second_row))
  21.     csvfile.write("\n")
  22.     csvfile.write(",".join(third_row))
  23.     csvfile.write("\n")
  24.