Skip to content

Instantly share code, notes, and snippets.

@riywo
Last active December 16, 2015 10:49
Show Gist options
  • Save riywo/5423408 to your computer and use it in GitHub Desktop.
Save riywo/5423408 to your computer and use it in GitHub Desktop.
cat("/etc/hosts").grep("localhost").head(:1).cut(:f => 1)
#=> "127.0.0.1"
cat /etc/hosts | grep localhost | head -1 | cut -f 1
#=> 127.0.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment