How do you extract IP addresses from files using a regex in a linux shell? February 27, 2023 by Tarik You could use grep to pull them out. grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' file.txt