August 3, 2009

LogParser TSV and C#

Someone asked me how to get TSV format using C#. Here is an example:
COMTSVInputContextClassClass input = LogParserOptions.CreateTSVInputFormat();

input.iCheckpoint = "Test.checkpoint";
input.nSkipLines = 5;
input.headerRow = false;
input.iSeparator = " ";
input.nSep = 3;
input.dtLines = 0;
input.codepage = -1;

return RunScript(scriptName, input);

//You will have to create a List of columns List or some option like this...this is what my RunScript looks like
public MyRecords RunScript(string queryName, object inputFormat)
{
return RunScript(queryName, null, inputFormat);
}

No comments:

Post a Comment