mirror of
https://github.com/AuxXxilium/yet-another-bench-script.git
synced 2024-11-23 23:01:02 +07: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
|
||||
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//\"}
|
||||
|
||||
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//\"}
|
||||
|
||||
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//\"}
|
||||
|
||||
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//\"}
|
||||
|
||||
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//\"}
|
||||
|
||||
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//\"}
|
||||
|
||||
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//\"}
|
||||
|
||||
echo
|
||||
@ -730,7 +730,7 @@ function iperf_test {
|
||||
done
|
||||
|
||||
# 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="--"
|
||||
|
||||
# parse the resulting send and receive speed results
|
||||
|
Loading…
Reference in New Issue
Block a user