Expand|Select|Wrap|Line Numbers
- class FileRead
- {
- public void ReadData()
- {
- FileStream fs = new FileStream("sample.log", FileMode.Open, FileAccess.Read);
- StreamReader sr = new StreamReader(fs);
- sr.BaseStream.Seek(0, SeekOrigin.Begin);
- string str = sr.ReadLine();
- while (str != null)
- {
- Console.WriteLine("{0}", str);
- str = sr.ReadLine();
- }
- sr.Close();
- fs.Close();
- Console.ReadLine();
- }
- public static void Main (string[] args)
- {
- FileRead fr = new FileRead();
- fr.ReadData();
- }
- }
sample.log:
8=FIX.4.39=61 35=534=149=ID E50=FX52=2010 1219-18:05:01.52256 =SAXOQUOTE10=1 71
8=FIX.4.39=81 35=A49=SAXOQUO TE56=IDE34=1 57=FX52=201012 19-18:06:02369=1 98=0108=30141 =Y10=082
8=FIX.4.39=85 35=149=SAXOQUO TE56=IDE34=2 57=FX52=201012 19-18:06:02369=1 112=20101219-18:06:0210=053
->Now the problem is I just wanted to print the specific fields from sample.log file in column wise manner or export the specific fields in csv file.
->That is the output should be like this :
Output:
9=61 35=5 52=20101219-18:05:01.522
9=81 35=A 52=20101219-18:06:02
9=85 35=1 52=20101219-18:06:02
Please help me with this.