shell perl 等

2021/10/21 7:13:05

本文主要是介绍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 perl 等的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程