grep IP subnet


starting with 192.x.x.x
cat ip_list.txt | grep -E "(192)(\.[0-9]{1,3}){3}"

starting with 192.168.x.x
cat ip_list.txt | grep -E "(192.168)(\.[0-9]{1,3}){2}"

starting with 192.168.10.x
cat ip_list.txt | grep -E "(192.168.10.)[0-9]{1,3}"

Leave a Reply

Your email address will not be published. Required fields are marked *