mirror of
https://github.com/masonr/yet-another-bench-script.git
synced 2025-04-19 00:45:22 +00:00
replace all 'grep -P' instances (#59)
This commit is contained in:
parent
f275b27f34
commit
dd110ee036
16
yabs.sh
16
yabs.sh
@ -278,25 +278,25 @@ function ip_info() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local country=$(echo "$response" | grep -Po '"country": *\K"[^"]*"')
|
local country=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^country/ {print $2}' | head -1)
|
||||||
country=${country//\"}
|
country=${country//\"}
|
||||||
|
|
||||||
local region=$(echo "$response" | grep -Po '"regionName": *\K"[^"]*"')
|
local region=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^regionName/ {print $2}')
|
||||||
region=${region//\"}
|
region=${region//\"}
|
||||||
|
|
||||||
local region_code=$(echo "$response" | grep -Po '"region": *\K"[^"]*"')
|
local region_code=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^region/ {print $2}' | head -1)
|
||||||
region_code=${region_code//\"}
|
region_code=${region_code//\"}
|
||||||
|
|
||||||
local city=$(echo "$response" | grep -Po '"city": *\K"[^"]*"')
|
local city=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^city/ {print $2}')
|
||||||
city=${city//\"}
|
city=${city//\"}
|
||||||
|
|
||||||
local isp=$(echo "$response" | grep -Po '"isp": *\K"[^"]*"')
|
local isp=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^isp/ {print $2}')
|
||||||
isp=${isp//\"}
|
isp=${isp//\"}
|
||||||
|
|
||||||
local org=$(echo "$response" | grep -Po '"org": *\K"[^"]*"')
|
local org=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^org/ {print $2}')
|
||||||
org=${org//\"}
|
org=${org//\"}
|
||||||
|
|
||||||
local as=$(echo "$response" | grep -Po '"as": *\K"[^"]*"')
|
local as=$(echo "$response" | sed -e 's/[{}]/''/g' | awk -v RS=',"' -F: '/^as/ {print $2}')
|
||||||
as=${as//\"}
|
as=${as//\"}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
@ -730,7 +730,7 @@ function iperf_test {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Run a latency test via ping -c1 command -> will return "xx.x ms"
|
# Run a latency test via ping -c1 command -> will return "xx.x ms"
|
||||||
[[ ! -z $LOCAL_PING ]] && LATENCY_RUN="$(ping -c1 $URL 2>/dev/null | grep -Po 'time=.*' | sed s/'time='//)"
|
[[ ! -z $LOCAL_PING ]] && LATENCY_RUN="$(ping -c1 $URL 2>/dev/null | grep -o 'time=.*' | sed s/'time='//)"
|
||||||
[[ -z $LATENCY_RUN ]] && LATENCY_RUN="--"
|
[[ -z $LATENCY_RUN ]] && LATENCY_RUN="--"
|
||||||
|
|
||||||
# parse the resulting send and receive speed results
|
# parse the resulting send and receive speed results
|
||||||
|
Loading…
x
Reference in New Issue
Block a user