Antoine_Sauteron_1266

Populating 2 columns of a .csv file

Discussion created by Antoine_Sauteron_1266 on Feb 15, 2017
Latest reply on Feb 15, 2017 by Antoine_Sauteron_1266
Hello,

I am looking to build a Windows job that will count activated tasks for a given day in WP logs, and write the time frame and counts into a separate 2-column csv file.

So far I could only manage to write the entries in separate lines. The output looks like this:

34za3vc1zlhk.png

Here are the objects that I use :

Promptset is used to set variables &LOG# and &DATE1# :
8ycn80boibac.png

Windows job - process tab
!convert date format so it can be searched in the logs
:SET &DATE# = CONV_DATE("YYYY-MM-DD:&DATE1#", "YYYYMMDD")

:SET &TIME# = "00"

!recursively increase the hour count until the end of the day
:WHILE &TIME# LE "23"

!convert time to a 2 digit character to match log file's format
:SET &TIME# = FORMAT(&TIME#,"00")

!Write the timestamp in the csv
echo &DATE#/&TIME# >> count.csv

!count tasks activated during the date/timestamp and write results in the csv file
findstr "&DATE#/&TIME#" "&LOG#" | findstr "activated" | find /C "activated" >> count.csv

!Increase the time stamp by one hour
:SET &TIME# = &TIME# + 1
:ENDWHILE

Do you know if there is a way to write every second line to column B ?

Any input would be highly appreciated :)

Best regards,
Antoine

Outcomes