Logparser Scenario 7:Searching specific column names from a CSV file
This blog entry is a continuation of the KB Article https://support.microsoft.com/?id=910447.
Scenario 7: Searching specific column data from a CSV file using Logparser
Let's say you have a CSV (comma separated value) text file as follows...
And then, you want the columns with the following names... (abc, abd and abe) so that you can get the following output...
Answer: You can use the following query
logparser "Select abc, abd, abe from C:\myfile.txt" -i:CSV
And you should get the following output...
You can also use EXTRACT_TOKEN (in case it is not a CSV and some other character separated file, for example Dash (-) separated values... The command to do that would be...
LogParser "Select EXTRACT_TOKEN(TEXT, 0, ',') as ONE, EXTRACT_TOKEN(TEXT, 1, ',') as TWO, EXTRACT_TOKEN(TEXT, 4, ',') as THREE from C:\MyFile.txt" -i:Textline
The output is quite similar... (except the header). But anyways, you get the idea
Hope that helps,
|Share this post :|
Quote of the day:
The best way to predict the future is to invent it. - Alan Kay