Created
August 22, 2018 15:10
-
-
Save kd7lxl/904b0c18002f8322098f056f375c3bcf to your computer and use it in GitHub Desktop.
Sorts a list of hostnames by their domain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import fileinput | |
print "".join(sorted(fileinput.input(), key=lambda fqdn: fqdn.lower().split('.')[::-1])), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment