#!/usr/bin/python
# -*- coding: utf-8 -*
import sys
import os

prefixes = [
  'LF_CR', 'LF_CS', 'LF_I', 'LF_SR',
  'LF_SS', 'LF_WR', 'LF_WS',
  'DF_CS', 'DF_SS', 'DF_WS', 'DF_I'
]
sufixes = [
  '_1', '_2', '_3', '_4'
]
FILE_TYPE = '.out'

run_no = 1
for suf in sufixes:
  print('Refresh Run ' + str(run_no))
  run_no += 1

  for pref in prefixes:
    file_name = pref + suf + FILE_TYPE
    out = pref + suf + ':'
    with open(file_name, 'r') as fd:
      # find rows in log file
      first = True
      for line in fd.readlines():
        # target line is like:
        #   x,xxx rows affected ...
        parts = line.split(' ', 2)
        if len(parts) > 2 and parts[1] == 'rows' and parts[0] != 'No':
          if first:
            out += ' ' + parts[0]
            first = False
          else:
            out += '    ' + parts[0]
      print(out)
      fd.close()
