05-13-2007
85,
0
Join Date: Apr 2007
Last Activity: 10 November 2016, 8:28 AM EST
Posts: 85
Thanks Given: 3
Thanked 0 Times in 0 Posts
Using Awk Script
Item #: 1
STATUS REPORT FOR JOB: Ftp
Generated: 2007-04-13 20:43:42
Job start time=2007-04-13 20:42:18
Job end time=2007-04-13 20:42:26
Job elapsed time=00:00:08
Job status=1 (Finished OK)
Item #: 2
STATUS REPORT FOR JOB: Ftp1
Generated: 2007-04-13 20:43:42
Job start time=2007-04-13 20:42:18
Job end time=2007-04-13 20:42:26
Job elapsed time=00:00:08
Job status=1 (Finished OK)
Item #: 3
STATUS REPORT FOR JOB: Ftp2
Generated: 2007-04-13 20:43:42
Job start time=2007-04-13 20:42:18
Job end time=2007-04-13 20:42:26
Job elapsed time=00:00:08
Job status=1 (Finished OK)
item.....
item ......
....................
awk 'BEGIN{ FS = "[=:]" }
/REPORT/ { ftp = $2 }
/Generated/ { generated = sprintf("%s:%s:%s", $2,$3,$4) }
/elapsed/ { elapsed = sprintf("%s:%s:%s", $2,$3,$4) }
/start time/ {start = sprintf("%s:%s:%s", $2,$3,$4) }
/end time/ {end = sprintf("%s:%s:%s", $2,$3,$4) }
/status/ { sub(/\(Finish.*/,"",$2); status=$2}
END {
printf "\%s\,\%s\,\%s\,\%s\,\%s\\n" , ftp,start,end,elapsed,status
}' "a.txt">b.csv
I used the above script to get the Items like
Ftp,2007-04-13 20:42:18,2007-04-13 20:42:26,00:00:08,1
Ftp1,2007-04-13 20:42:18,2007-04-13 20:42:26,00:00:08,1
Ftp2,2007-04-13 20:42:18,2007-04-13 20:42:26,00:00:08,1
how can i achieve this