grep多个日志文件然后聚合到同一文件中
#!/bin/bash
array=(/opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-01 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-02 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-03 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-04 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-05 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-06 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-07 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-08 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-09 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-10 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-11 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-12 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-13 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-14 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-15 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-16 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-17 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-18 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-19 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-20 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-21 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-22 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-23 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-24 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-25 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-26 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-27 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-28 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-29 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-30 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-05-31 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-01 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-02 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-03 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-04 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-05 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-06 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-07 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-08 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-09 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-10 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-11 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-12 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-13 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-14 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-15 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-16 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-17 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-18 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-19 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-20 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-21 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-22 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-23 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-24 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-25 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-26 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-27 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-28 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-29 /opt/scf2/log/SaleSceneExperiment/SaleSceneExperiment.log.2022-06-30)
for file1 in ${array[@]};
do
echo $file1
grep '回传给crm的消息体' $file1 |grep 'oppLabel":"a'|grep 'releaseCause":"106' >> opp6.log
done