#!/bin/bash
source $HOME/.bashrc

set=$1
for date in $(seq 20211101 20211108); do
	echo ${date}
	year=$(echo ${date} | cut -c 1-4)
	month=$(echo ${date} | cut -c 5-6)
	day=$(echo ${date} | cut -c 7-8)
	if [ ! -d /tmp/g1en_s${set}_money_2_non_53 ]; then
		mkdir -p /tmp/g1en_s${set}_money_2_non_53
	fi
	if [ -f ~/servers${set}/Log/${date}/MissionServer${set}/twolevel.log.${year}-${month}-${day}.xz ]; then
		xcat ~/servers${set}/Log/${date}/MissionServer${set}/twolevel.log.* | twolevel_comma | perl -ne 'print "$1\n" if /(log,(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})(,\d{3,4}),\S+,money,(\S+),\w{5},(\d{1,2}),(\w+),(\d+),(\d+),(\d+),(\d+),(\d+),\d+,2,\d+,\d+,1,\d+)/' | grep -v ',53,' > /tmp/g1en_s${set}_money_2_non_53/s${set}_${date}_money_2_non_53.log
	fi
done

