Grep IP Addresses
A grep command to get all IP addresses contained in a text file
A grep command to get all IP addresses contained in a text file:
$ grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' IPs-To-Grep.txt > Grepped-ips.txt
Grep IP Address with their CIDRs from a text file:
egrep -o '[0-9]+[.][0-9]+[.][0-9]+[.][0-9]+/[0-9]+' scope.txt > final-scope.txt
Last updated
Was this helpful?