How to extract IPv4 address from a file October 21, 2015 cat file.txt | perl -nle '/[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/ and print $&' > output.txt Read more