开发者

How to periodically extract data from a CSV file?

开发者 https://www.devze.com 2023-02-21 03:51 出处:网络
I\'m currently working in some Q&A projects. I am running tests (which can vary from a couple of minutes to 2-3 days) in an applications that is generating some csv files and updates them periodic

I'm currently working in some Q&A projects. I am running tests (which can vary from a couple of minutes to 2-3 days) in an applications that is generating some csv files and updates them periodically, with a new row added with each update (once every couple of seconds or so). Each CSV file is structured like this:

Header1,Header2,Header3,.................,HeaderN numerical_value11,numerical_value12,numerical_value13,......,numerical_value1N, numerical_value21,numerical_value22,numerical_value23,......,numerical_value1N, etc

The number of columns may vary from csv file to csv file. I am running in a windows environment. I开发者_运维技巧 also have cygwin (http://www.cygwin.com/) installed.

Is there a way I can do a script that runs periodically (once per hour or so), extracts data (a single/multiple values from a row, or the average of the the values from specific rows added in the csv between interrogations) and sends some email alerts if, for example, the data from one column is out of a range?

Thx


This can be done in several ways. Basically, you need to

1) Write a script in maybe pearl or python that does one iteration of what you want it to do.

2) Use windows scheduler to run this scrip at the frequency that you want. The Windows scheduler is very easy to setup from the Control Panel


Using Window' Scheduling, you can very easily get the interval part down; with the program parsing and alerting however, you have a few options. I myself would use C# to make the program. If you want an actual script however, VBA is a viable choice and could very easily Parse a basic CSV file and contact the web to send an email. If you have office already installed, this should give you some more detail. Hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消