1) Regular expression / seamingly lost art of sprintf formatting are some methods to normalize 001:db8::2:1 to something usable for sorting aka 2001:db8:0000:0000:0000:0000:0002:0001. Perhaps restoring to rfc 5952 format when printing sorted results.
2) Modify hex to 'sortable utf-16 characters', modify back post sort[1]
3) avoid utf-8 / utf-16 issues, use relevant python libraries to handle ipv4/ipv6[2][3],[4]: ip2n < file | sort -n | n2ip
----------------------------
[0] : https://datatracker.ietf.org/doc/html/rfc5952
[1] : https://stackoverflow.com/questions/5797369/unix-sort-utilit...
[2] : https://stackoverflow.com/questions/75522231/how-to-sort-ipv...
[3] : https://www.geeksforgeeks.org/convert-ip-address-to-integer-...
[4] : https://ipfind.com/blog/how-to-convert-ip-address-to-integer...