dreamno

导航

 

curl status code

#/bin/bash
# curl
# -I 仅测试HTTP头
# -m 10 最多查询10s
# -o /dev/null 屏蔽原有输出信息
# -s silent 模式,不输出任何东西
# -w %{http_code} 控制额外输出

# 正则比较
# [[ "$str" =~ ^he.* ]]
# 包含变量时,变量使用双引号括起来
# [[ "$str" =~ ^"${JAR_NAME}".* ]]


while [[ 1 -eq 1 ]]; do
    a=$(curl -I -m 10 -o /dev/null -s -w %{http_code} www.baidu.com)
   # 正则比较
    if [[ "$a" =~ ^200.* ]]; then
        return
    fi
    sleep 5
done

高亮

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="<3";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
posted on 2021-10-20 16:55  dreamno  阅读(29)  评论(0编辑  收藏  举报