Skip to content

Instantly share code, notes, and snippets.

@andcam
Created November 29, 2022 09:01
Show Gist options
  • Save andcam/c6462b0afe5e047b831d08abb306fc7b to your computer and use it in GitHub Desktop.
Save andcam/c6462b0afe5e047b831d08abb306fc7b to your computer and use it in GitHub Desktop.
extract, sort and count IP4 address from any text file
awk '/^[0-9.]+[.][0-9]+[.][0-9]+[.][0-9]+$/{if(!a[$0]++)print $0}' RS="[ :/\n]" file.txt | sort | uniq -c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment