shell perl 等
作者:互联网
高亮
tail -f xls2csv.sh |perl -pe 's/(csv)/\e[1;31m$1\e[0m/g'
数据替换
grep -E '_id|PHONE|PROFILE30|PROFILE31|PROFILE32|PROFILE35' LABEL272_VALUE_label > LABEL272_VALUE_label_2
统计bug,并根据计数排序
$NF最后一列为创建时间 $NF-1为处理人
awk -F "," '/^(1|2|3)/{++time[$NF]} END {for(i in time) print time[i],"\t",i}' bugs.csv | sort -t " " -k 2
查看 uat分支有提交 但是在测试上没有提交的内容
grep -- 解决 grep: invalid option -- > 报错
grep -Ri '->someFunction' 重现
for i in git log --oneline |sed -E 's/^.{9}//g' | sed -e 's/^\s+//'
do
if [[ glol release/dice | grep -- "$i" | wc -l
-eq 0 ]]; then
glol | grep -- "$i"
fi
done
/bin/bash
file=$1
path=echo $file |sed -E 's#(.*)/(.*)#\1#'
filename=echo $file | sed -E 's#(.*)/(.*)#\2#'
if [ -z $file ]; then
echo "should input csv file path"
exit 1
fi
result=""
for i in grep -E '^(\d)' $file | sed -E 's/( )+//g'
do
# echo "$i"
id=echo $i | cut -d "," -f 1
etime=echo $i | awk -F "," '{print $(NF-2)}'
stime=echo $i | awk -F "," '{print $NF}'
if [[ -z echo $etime | grep -E '^(\d)'
]]; then
continue
fi
# echo "id = $id"
# echo "stime = $stime"
# echo "etime = $etime"
# s_y
# s_m
# s_d
time_s=`date -j -f "%Y-%m-%d" "$stime" "+%s"`
time_e=`date -j -f "%Y-%m-%d" "$etime" "+%s"`
# if [ "180315"="$id" ]; then
# echo "id = $id"
# echo "stime = $stime"
# echo "etime = $etime"
# break
# fi
use=$((($time_e-$time_s)/60/60/24))
result="$result\n$id\t$use"
# echo "$id, $use"
# time_s=""
# time_e=""
done
echo $result > $path/tmp
grep -E '^(\d)' $path/tmp > $path/tmp2
awk -F "\t" 'BEGIN {t0="❤️";t3=">=3";t5=">=5";t10=">=10"} {if($2<3){s[t0]++} else if($2<5){s[t3]++}else if($2<10){s[t5]++}else s[t10]++} END {for (i in s) print i,"\t",s[i]} ' $path/tmp2
标签:shell,grep,etime,echo,stime,time,perl,id 来源: https://www.cnblogs.com/blogabc/p/15429609.html