# csv - How to schedule a basic unix command using sed

Apreciate any help and excuse me if my terminology is incorrect.

sed -i '1,6d;$d' *.csv This unix command, run on cygwin, will go through all the files in the directory that end with .csv. For each file it deletes the 1st 6 rows and the last row and that's the returned file. My question is how do I go about scheduling this so that it is run on a certain directory periodically? Note: I have a fair idea around basic unix commands. Also, I currently do some scheduling, using task scheduler in windows XP, using vbs to work on some excel files. You can run cron on windows which allows scheduling bash (cygwin) scripts too. Here is the related Stackoverflow discussion. If you don't want this, you can create a .bat batch file with contents like chdir C:\where\you\want\to\run\this\script C:\Cygwin\Or_where\you\installed\bin\sed.exe -i '1,6d;$ d' *.csv


And run this batch file from the Windows scheduler.

Then there is the windows version of the at command which works a bit like the *nix cron. Here is an explanation.