mercredi 22 août 2018

(standard_in) 1: syntax error when bc within if

Getting the error:

(standard_in) 1: syntax error

When running the below script:

#!/bin/bash
while read line
do time=$(echo $line|awk '{print $10}'|awk -F"=" '{print $2}')
if (( $(echo "$time > 100" | bc -l) ))
then echo $line
fi
done  < ping.txt

The ping.txt file contains lines like below:

2018-08-15 13:45:54: 64 bytes from c1pafapp0002.insim.biz (10.206.131.117): icmp_seq=7163 ttl=62 time=327 ms

basically i am trying to find all lines where time > 100 ms

Aucun commentaire:

Enregistrer un commentaire