Using awk with autosys autorep

Hi,

How to get correct field/column from autosys autorep command. I'm using GNU/Linux

I'm trying to get the difference of last end and last start and the status (ST).
In awk, i get the following excluding the heading part
$1 - jobname
$2 - Last Start date
$3 - Last Start time
$4 - Last End date
$5 - Last End time
$6 - Status (ST)
However the above result changes if date/time is '-----' and will get the following results.
$1 - jobname
$2 - -----
$3 - -----
$4 - Last End date

I'm trying to get the correct field names to its correct variable (either date and time to separate variables or to one variable).

Lets say, I have the following example.

hostname> autorep -J ABC_Box_Name
Job Name                     Last Start           Last End             ST Run     Pri/Xit
____________________________ ____________________ ____________________ __ _______ ___
ABC_Box_Name                 08/06/2012 16:41:07  08/06/2012 16:47:19  SU 3468359/5
 def_Job_Name                -----                -----                IN 3429876/2
 ghi_Job_Name                -----                -----                OH 3429876/6
 jkl_Job_Name                -----                -----                OI 3429876/4
 mno_Job_Name                -----                -----                RU 3429876/6
 abc_123456789012345678_long_job_Name                                   08/06/2012 16:46:17  08/06/2012 16:46:34  SU 3429876/4
 pqr_Job_name                08/06/2012 16:46:00  08/06/2012 16:46:11  ST 3429876/4
 stu_Job_Name                08/06/2012 16:44:50  08/06/2012 16:45:17  SU 3429876/6

Let me know the better way if not awk..

you'll have 2 fewer fields if LastStart/LastEnd fields contain '-----'.
I'd suggest checking for the number of fields and using the mnemonic field names - something along these lines:

lastStartT=(NF==7)?$3:"-----"
lastEndD=(NF==7)?$4:"-----"
lastEndT=(NF==7)?$5:"-----"
.....
# and so on for the rest of the fields.... you can use the mnemonic variable names whenever needed after that...