You could do this in many different languages. Regular expressions in C# would work just fine for this. There are many ways to do it, depending on a number of factors such as input file size. A simple way would be to read all lines of the source file, iterate over each line using a regular expression to identify a match, and if matched, write the line to a target file.
Something like this could be a starting point.
public static string Foo()
{
// see http://stackoverflow.com/questions/4890789/regex-for-an-ip-address
Regex ip = new Regex(@"\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b");
string[] inputLines = File.ReadAllLines("sourcefile.txt");
List<string> outputLines = new List<string>();
foreach (string line in inputLines)
{
MatchCollection result = ip.Matches(line);
if (result[0].Success) outputLines.Add(line);
}
if (outputLines.Count > 0)
{
File.AppendAllLines("destinationfile.txt", outputLines);
}
}