mtr_findloss.sh - randomcrap - random crap programs of varying quality
(HTM) git clone git://git.codemadness.org/randomcrap
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
mtr_findloss.sh (408B)
---
1 #!/bin/sh
2 # run for a while:
3 # while :; do mtr -rwc 50 -i 0.2 -rw codemadness.org; done | tee -a ~/mtr_codemadness.txt
4 #
5 # filter and highlight entries with packet loss (prefixed with >).
6
7 awk '{
8 l = $0;
9 idx = index(l, "%");
10 if (!idx || idx < 6) {
11 print " " l
12 next;
13 }
14 s = substr(l, idx - 5, 6);
15 gsub("[^0-9\.]+", "", s);
16 if (s != "" && s != "0.0") {
17 print "> " l
18 } else {
19 print " " l
20 }
21 }'