Skip to content

Instantly share code, notes, and snippets.

@sergeyhush
Last active March 6, 2018 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergeyhush/b253cd38f0b080ddcf3b013d27dedb0a to your computer and use it in GitHub Desktop.
Save sergeyhush/b253cd38f0b080ddcf3b013d27dedb0a to your computer and use it in GitHub Desktop.
Sort /etc/hosts
#!/bin/sh
# Sort /etc/hosts file IPv4 only skipping empty lines and commented out ones
sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n /etc/hosts | grep . | grep -v '^#'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment