记一次线上log去重脚本

记一次线上log去重脚本

六月 22, 2018
1
2
# cat charge |wc -l
# cat charge |sort|uniq |wc -l
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!bin/bash
ls -l charge |awk '{print $9}' > all_list.txt
all_charge_log='./all_list.txt'
rm -rf replace/*

for each_charge in cat ${all_charge_log};do
cat ${each_charge} |sort|uniq > ./replace/${each_charge}
done

chown -R jenkins:jenkins replace/

/usr/bin/zip -r test.zip ./replace/charge.log


2>&1 是将标准出错重定向到标准输出,这里的标准输出已经重定向到了out.file文件,即将标准出错也输出到out.file文件中