grep.1posix -oP '\d+\.\d+\.\d+\.\d+(\/.\d+|)' file_with_ips
search a file for a pattern
source manpages: grep