Take the 2-minute tour ×

I have something like this:

"Content-Transfer-Encoding: base64


That ends with a line like this:


It is a file with MIME format, i thought about putting "base64\r\n" and it will end when it finds "=", but i am missing the way to cut that selection that from the text file to put it in another one. I am trying with streamreader and streamwriter but with no luck so far.

share|improve this question
What exactly are you trying to do with this text file? –  Oded Mar 5 '10 at 15:23
add comment

2 Answers

Try using:


It will return an array in which each item is a paragraph of text.

I Hope that helps.

share|improve this answer
add comment

I need to cut that MIME from a email that will change from time to time i need to code it so it can distinguish the MIME part from the rest and copy that in a text file so i can decode it.

I tried before to use split, but when i used it with ("\r\n\r\n") it says that it has some invalid arguments.

Before this, i used the ReadAllLines to choose fields separated with a ";" for example like this:

string[] lines2 = System.IO.File.ReadAllLines(@"../../../mime.txt");
IEnumerable<string> query2 =
            from line2 in lines2
            let w = line2.Split("\r\n\r\n")
            where line2.Contains("$") & line2.EndsWith("ain")
            select w[0] + ";" + w[1] + ";" + w[2] + ";" + w[3] + ";" + w[4] + ";";
System.IO.File.WriteAllLines(@"../../../Bloq.csv", query2.ToArray());

And it worked just fine, i tried to use that but because i will get all the lines corresponding to the MIME i thought that it wouldn't work in my case.

share|improve this answer
Clever, glad it ended up working :) –  cazlab Mar 7 '10 at 13:59
add comment

Your Answer


