Skip to content

Instantly share code, notes, and snippets.

@Sam-R
Created June 23, 2021 12:09
Show Gist options
  • Save Sam-R/144a50b5d08caa40e74b4c801916bcbf to your computer and use it in GitHub Desktop.
Save Sam-R/144a50b5d08caa40e74b4c801916bcbf to your computer and use it in GitHub Desktop.
Extract IPv4 addresses from /etc/hosts file
cat /etc/hosts | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | awk '{ print $1 }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment