Search code examples
csvrecursionlogparser

Recurse through CSV input files with logparser


I have a large collection of CSV formatted reports related to faxes received over a period of time. I am attempting to parse through these reports using logparser to obtain a total number of pages received. I see that the -i:csv option does not support recursion of directories. As an example, here is how I would write the query if -csv supported recursion:

logparser -i:csv -o:datagrid -headerrow:on "SELECT SUM(NUMPAGES) FROM *2014*.csv"

For now I am not looking to group by any one column, just getting a grand total.


Solution

  • Yup, CSV does not support recursion. You could use a shell script to visit the directories recursively and compile a comma-separated list of paths, which you can then pass to the FROM clause.