I have created the following awk script which I use to display the completion time of jobs:
This works fine for displaying the completion time using input in the format shown below.
Sep 22 10:15:44 server123 root: .CASH_I_0069 jobset1 job22 0001 2201 Started at 10.15.44 at node server123, Pid = 00019551
Sep 22 10:20:44 serverB root: .CASH_I_0069 jobset33 job1 0001 2201 Started at 10.20.44 at node sysmgt, Pid = 00019551
Sep 22 10:21:03 serverB root: .CASH_I_0054 jobset33 job1 0001 2201 Completed at 10.21.03, code: 00000000 at node serverB, Pid = 00019551
Sep 22 10:28:42 server123 root: .CASH_I_0054 jobset1 job22 0001 2201 Completed at 10.28.42, code: 00000000 at node server123, Pid = 00019385
The resulting output of the awk script is:
Jobset Job End Date End Time Status RC
===============================================================================
jobset33 job1 Sep 22 10:21:03 Completed 00000000
jobset1 job22 Sep 22 10:28:42 Completed 00000000
What I would like to accomplish is displaying both the start and end times for each job using 1 awk script.
I would like to capture fields 1, 2, 3, 7, and 8 from the "Started" lines and fields 1, 2, 3, 11, and 15 from the corresponding "Completed" line.
The final output should be:
Jobset Job Start Date Start Time End Date End Time Status RC
===============================================================================
jobset33 job1 Sep 22 10:20:44 Sep 22 10:21:03 Completed 00000000
jobset1 job22 Sep 22 10:15:44 Sep 22 10:28:42 Completed 00000000
Any help would be greatly appreciated.
Thanks,
John
Code:
#-----jobchk.awk-----
#Used to print completed jobs from the syslog.
#
BEGIN {print "\n";printf ("%-10s %-10s %-11s %11s %10s %8s\n","Jobset","Job","End Date","End Time", "Status", " RC");print "==============================================================================="}
/01 Completed/{jobset = $7; job = $8; edate = $1; edated = $2; status = $11; etime = $3 ; rc = $15; if (NF>=13) printf ("%-10s %-10s %-3s %-10s %-12s %-12s %-6s\n", jobset, job, edate, edated, etime, status, rc)}
END{print ""}
Sep 22 10:15:44 server123 root: .CASH_I_0069 jobset1 job22 0001 2201 Started at 10.15.44 at node server123, Pid = 00019551
Sep 22 10:20:44 serverB root: .CASH_I_0069 jobset33 job1 0001 2201 Started at 10.20.44 at node sysmgt, Pid = 00019551
Sep 22 10:21:03 serverB root: .CASH_I_0054 jobset33 job1 0001 2201 Completed at 10.21.03, code: 00000000 at node serverB, Pid = 00019551
Sep 22 10:28:42 server123 root: .CASH_I_0054 jobset1 job22 0001 2201 Completed at 10.28.42, code: 00000000 at node server123, Pid = 00019385
The resulting output of the awk script is:
Jobset Job End Date End Time Status RC
===============================================================================
jobset33 job1 Sep 22 10:21:03 Completed 00000000
jobset1 job22 Sep 22 10:28:42 Completed 00000000
What I would like to accomplish is displaying both the start and end times for each job using 1 awk script.
I would like to capture fields 1, 2, 3, 7, and 8 from the "Started" lines and fields 1, 2, 3, 11, and 15 from the corresponding "Completed" line.
The final output should be:
Jobset Job Start Date Start Time End Date End Time Status RC
===============================================================================
jobset33 job1 Sep 22 10:20:44 Sep 22 10:21:03 Completed 00000000
jobset1 job22 Sep 22 10:15:44 Sep 22 10:28:42 Completed 00000000
Any help would be greatly appreciated.
Thanks,
John