cleanbrowsing/dnsperftest

IPv6 addresses result in misaligned columns

frnkblk opened this issue · 4 comments

The script apparently pulls the system's default DNS server entries. In my case, one of those is an IPv6 address (2607:fe28:0:1000::5), and because its length, pushes the columns over, so the recommend sort doesn't work correctly:

root@frankb-PC:/mnt/c/Users/fbulk/dnsperftest# bash ./dnstest.sh | sort -k 22 -n
2607:fe28:0:1000::519 ms 40 ms 22 ms 10 ms 31 ms 9 ms 24 ms 47 ms 9 ms 65 ms 27.60
test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 Average
premier2 16 ms 14 ms 12 ms 13 ms 13 ms 10 ms 9 ms 11 ms 13 ms 11 ms 12.20

tssva commented

Try bash dnstest.sh | awk '{print $NF,$0}' | sort -n | cut -f2- -d' '. This should work no matter the number of columns.

  1. awk prints the final field of each row, using spaces to deliminate the fields, and then the complete row.
  2. sort then sorts the rows based upon the first field which is now the copy of the average field added by awk.
  3. cut then removes the copy of the average field that was added by awk and prints the rest of the row.

Thanks!

You might be interested in #52, where I added a list of default IPv6 providers to test, using the symlink dnstest6.sh.

Thanks! That's fixed now - sorry for the delayed response.