I'm having a list of strings (sorted IP address ranges) like this:
10.100.0.0-10.100.255.255 External: 188.8.131.52 10.120.0.0-10.255.255.255 External: 184.108.40.206 10.0.0.0-10.255.255.255 External: 220.127.116.11 192.168.160.1-192.168.160.255 External: 18.104.22.168 and so on..
How can I group these by the last string of each line so that the result would look similar to this:
External: 22.214.171.124 10.100.0.0-10.100.255.255 10.120.0.0-10.255.255.255 External: 126.96.36.199 10.0.0.0-10.255.255.255 192.168.160.1-192.168.160.255
Note: Handling of IP addresses is not required. We can treat these as strings as they are already sorted and ordered. I'm looking for a pure Bash solution (not Python) and preferably without xargs.
Thanks in advance!