I recommend to you to do it on the fly, like other people is saying The only thing you must be care about is to make the stream flush to prevent memory problems, i mean
void CopyLines(string inFile, string outFile){
StreamReader sr = new StreamReader(File.Open(inFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
StreamWriter sw = new StreamWriter(outFile);
string line;
while (!sr.EndOfStream) {
line = sr.ReadLine();
if ( Match(line) ) {
sw.WriteLine(line);
}
sw.Flush();
}
sr.Close();
sw.Close();
}
Maybe the Flush method should be not always called, i mean like if (i % 100 == 0) sw.Flush(), or use the AutoFlush property
Saludos!! ____Juan