Created
May 23, 2017 12:14
-
-
Save curipha/1e6cc8ff46357732fe51e787d9f3ce65 to your computer and use it in GitHub Desktop.
Sort the list of FQDN (e.g. www.example.com)
This file contains 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 ruby | |
fqdn = [] | |
while STDIN.gets | |
fqdn << $_.strip | |
end | |
def s(l) | |
return l.split('.').reverse.join('.') | |
end | |
puts fqdn.sort {|a, b| s(a) <=> s(b) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment