Using awk with autosys autorep


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Using awk with autosys autorep
# 1  
Old 08-07-2012
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.
Code:
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..

Last edited by bobbygsk; 08-07-2012 at 05:23 PM.. Reason: Additional info
# 2  
Old 08-07-2012
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:
Code:
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...

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk output yields error: awk:can't open job_name (Autosys)

Good evening, Im newbie at unix specially with awk From an scheduler program called Autosys i want to extract some data reading an inputfile that comprises jobs names, then formating the output to columns for example 1. This is the inputfile: $ more MapaRep.txt ds_extra_nikira_usuarios... (18 Replies)
Discussion started by: alexcol
18 Replies

2. Shell Programming and Scripting

Command to check only Autosys running jobs with autorep like command

Hi, Is there any specific command to use to check only say Running jobs via autorep or similar command for Autosys? (0 Replies)
Discussion started by: sidnow
0 Replies

3. Shell Programming and Scripting

awk - Parsing Autosys JIL

I'm trying to modify the script given in post 7 of the following thread: 146564-need-parse-jil-file-into-excel-file.html. (Sorry, can't post the URL as I don't have enough posts.) The original script is as follows: awk -F ' *_]*: *' 'BEGIN ... (9 Replies)
Discussion started by: GnuScripter
9 Replies

4. Shell Programming and Scripting

autorep command in the script

I have created UNIX script for getting information for the autosys jobs using autorep command. Job_name=temp_job1 echo $Job_name autorep -j $job_name -l0 After running the script I am getting the below error Error while loading shared libraries: libautoeac_api.so: cannot share object... (1 Reply)
Discussion started by: onesuri
1 Replies

5. UNIX for Advanced & Expert Users

autosys command(autorep) from command prompt

Hi, I am using AUTOSYS GUI based tool. But I want to get the job status from the UNIX command prompt. 1. I want to execute only autorep command in the UNIX command prompt. If need to execute this command what are the settings need to do that. 2. Is it possible for executing this... (5 Replies)
Discussion started by: onesuri
5 Replies

6. UNIX for Dummies Questions & Answers

Autosys: How to change a machine name in Autosys JIL.

All the autosys jobs are on server-1 and server-1 has been crashed due to some reason, Now I have to run 5 autosys jobs on server-2 (failover server) which are on server 1. How to do with Autosys command (which command needs to fired on JIL) (0 Replies)
Discussion started by: tp2115
0 Replies

7. Shell Programming and Scripting

autorep command in autosys

hi, i have autosys installed on unix. i use "autorep -j t8i%" command to see the scheduled jobs. now i have changed some of the jobs and saved them too. i gave the command jil< filename.jil to again insert the jobs. but my problem is what is the command to run all the jobs again so that i... (8 Replies)
Discussion started by: tejasingaraju17
8 Replies

8. Shell Programming and Scripting

autorep command cut longer jobnames. Anybody into autosys / autorep?

Hi there, my problem is, that i need to get all jobs with status from a autosys instance. If I use autorep -J ALL -d >joblist.txt longer Jobnames will be cut and the end will be replaced by 3 points like this "ThisIsALongerJobNameAnd..." If i try a single job query like ... (7 Replies)
Discussion started by: drmaniac
7 Replies

9. Shell Programming and Scripting

autorep command to get autosys command

Hi, how can i use unix shell command to get the autosys commands for a set of given jobs? autorep -J EMP% -w returns all autosys jobnames starting with EMP and runtimes However, i also want to see the autosys 'command' corresponding to the above jobs. I don't want to sql query the... (1 Reply)
Discussion started by: ysrinu
1 Replies

10. UNIX for Advanced & Expert Users

Documentation and books on Autosys Job Control Tool from Autosys

My project uses Autosys. I am new to this product and I don't know where to start from. Q1. Please provide me the link where I can get Autosys documentation Q2. Please refer a good book on Autosys. (Beginner/Intermediate Level) (0 Replies)
Discussion started by: gram77
0 Replies
Login or Register to Ask a Question