How do I extract just the IP addresses from a text file which has an IP address per line? I would like to extract the IPs and then list the IP addresses in a separate file.
while(<>) { print "$1\n" if /\b(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\b/; }
use Regexp::Common qw/net/; while (<>) { print $1, "\n" if /($RE{net}{IPv4})/; }