This is the code that I have written in C# which shows the contains in the sample.log file.
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();
}
}
->The sample.log file contains following data fields
sample.log:
8=FIX.4.39=6135=534=149=IDE50=FX52=20101219-18:05:01.52256=SAXOQUOTE10=171
8=FIX.4.39=8135=A49=SAXOQUOTE56=IDE34=157=FX52=20101219-18:06:02369=198=0108=30141=Y10=082
8=FIX.4.39=8535=149=SAXOQUOTE56=IDE34=257=FX52=20101219-18:06:02369=1112=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.