Skip to content

Instantly share code, notes, and snippets.

@artyom
Created June 1, 2012 12:36
Show Gist options
  • Save artyom/2851833 to your computer and use it in GitHub Desktop.
Save artyom/2851833 to your computer and use it in GitHub Desktop.
filter out ipv4 ips from stdin/file(s)
#!/bin/sh -e
cat $@ | tr -cs '0-9\.' '\n' | awk -F'.' 'NF==4 && $1 > 0 && $1<=255 && $2<=255 && $3<=255 && $4<=255 && !/\.\./'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment