export LANG=Shift-JIS
grep " Item-"
sed 's/,/ /g'
sed 's/".\{0,20\}",//g'
sed 's/\.history:/,/g'
awk -F[,-] '{if($16==9) print $2,$6,$12,$13,$14,$15,$16}'


tail game20121212_a.txt | grep " Item-" | sed 's/".\{0,20\}",//g' | sed 's/\.history:/,/g' | awk -F[,-] '{if($16==9) print $2,$6,$12,$13,$14,$15,$16}'
grep " Item-" game20121217_a.txt | sed 's/".\{0,20\}",//g' | sed 's/\.history:/,/g' > game20121217_b.txt
sed 's/\.history:/,/g' game20121213_b.txt | awk -F[,-] '{print $2,$3,$10,$11,$12,$13,$14}' > game20121213_c.txt
sed 's/,/ /g' 20121213.txt | awk '{if($16==9) print $1,$6,$11,$12,$13,$14,$15,$16}' | grep " Item+ " > 20121213_c.txt
sed 's/,/ /g' game20121212.txt | awk '{if($16==9) print $1,$6,$11,$12,$13,$14,$15,$16}' | sed 's/ /,/g' > game20121212_a.txt
sed s/".history"//g game20121212.txt | awk -F[,:-] '{if($18==9) print $2,$8,$14,$15,$16,$17,$18}'

------------------------------------------------------------

load data local infile 'C:/cs/minus2/game220121214_c.txt'
into table test.game2_m fields terminated by ' '(t,charac_no,slot_type,it_id,count,amount,reason);

truncate game1_p_total;

insert into game1_p_total(charac_no, it_id, count)
select charac_no, it_id, sum(amount)
from game112_p
where reason in(9,21) and it_id in(select * from emblem) group by charac_no, it_id;

truncate game1_m_reason;
truncate game1_result;

insert into game1_m_reason(charac_no, it_id, count, reason)
select charac_no, it_id, sum(amount), reason
from game1_m as t1 where reason in(3,5,6,8) and exists (select 1 from emblem as t2 where t1.it_id=t2.it_id)
group by charac_no, it_id, reason;

insert into game1_result(charac_no, count)
select t1.charac_no , (t1.count - if(t2.count is null , 0 , t2.count)) as total
from
 (select charac_no , sum(count) as count from game1_p_total group by charac_no) as t1
left outer join  
 (select charac_no , sum(count) as count from game1_m_reason group by charac_no) as t2
on t1.charac_no = t2.charac_no
union
select t2.charac_no , ( if(t1.count is null , 0 , t1.count) - t2.count) as total
from
 (select charac_no , sum(count) as count from game1_p_total group by charac_no) as t1
right outer join  
 (select charac_no , sum(count) as count from game1_m_reason group by charac_no) as t2
on t1.charac_no = t2.charac_no;

select * into outfile 'C:/cs/game12.csv' fields terminated by ',' from game1_result where count>0;

select charac_no , sum(count) from game1_m_reason where charac_no = 66027;

select * from game1_p_total as t1 where
not exists ( select 1 from game1_m_reason as t2 where t1.charac_no = t2.charac_no)
limit 10;

show create table game1_m_reason;

'Develop' 카테고리의 다른 글

fatal error C1004: unexpected end-of-file found  (0) 2013.01.03
Log에서 데이터 추출 2  (0) 2012.12.27
Check Listen Port  (0) 2012.11.14
gdb 명령어  (0) 2012.11.08
mysql 유일한값 뽑아내기  (0) 2012.11.08

+ Recent posts