Sponsored Content
Top Forums Shell Programming and Scripting need to parse the jil file into an excel file Post 302464144 by Scrutinizer on Tuesday 19th of October 2010 11:15:26 AM
Old 10-19-2010
We can not use a comma as a output field separator since some of the fields contain commas. I used a semicolon instead, which is fine for importing into Excel.
Code:
awk -F ' *[[:alnum:]_]*: *' 'BEGIN         {h="insert_job;box_name;command;owner;permission;condition;description;std_out_file;std_err_file;alarm_if_fail"; print h; n=split(h,F,/;/)}
                             function pr() {if(F[1] in A) {for(i=1;i<=n;i++)printf "%s%s",A[F[i]],(i<n)?";":RS}}
                             /insert_job/  {pr(); delete A}
                                           {for(i in F){if($0~"^"F[i])A[F[i]]=$2}}
                             END           {pr()}' infile

This produces:
Code:
insert_job;box_name;command;owner;permission;condition;description;std_out_file;std_err_file;alarm_if_fail
backupJIL;;autorep -J ALL -q > /home/autosys/...p/autosys_jil_bk;autosys@machine;gx,ge,wx,we;;"Daily backup of job definitions";/tmp/autosys_jil_backup.out;/tmp/autosys_jil_backup.err;1
BC_mount;S..fresh_box;/sysadm/xp/bin..odbc.sh;autosys@machine;gx,wx;success(Check_BC_Status);"Mount the BCs on machine";>/var/tmp/mountprodbc.log;>/var/tmp/mountprodbc.err;1

What made it a bit more complex is that not all of the fields are present in every record.
The input file seemed to be a bit crooked, I used this as a basis, hope that is OK:
Code:
/* ----------------- backupJIL ----------------- */

insert_job: backupJIL job_type: c
command: autorep -J ALL -q > /home/autosys/...p/autosys_jil_bk
machine: machine
owner: autosys@machine
permission: gx,ge,wx,we
date_conditions: 1
days_of_week: tu,we,th,fr,sa
start_times: "17:00"
description: "Daily backup of job definitions"
std_out_file: /tmp/autosys_jil_backup.out
std_err_file: /tmp/autosys_jil_backup.err
alarm_if_fail: 1
/* ----------------- BC_mount ----------------- */

insert_job: BC_mount job_type: c
box_name: S..fresh_box
command: /sysadm/xp/bin..odbc.sh
machine: machine
owner: autosys@machine
permission: gx,wx
condition: success(Check_BC_Status)
description: "Mount the BCs on machine"
std_out_file: >/var/tmp/mountprodbc.log
std_err_file: >/var/tmp/mountprodbc.err
alarm_if_fail: 1

S.

Last edited by Scrutinizer; 10-19-2010 at 03:24 PM..
This User Gave Thanks to Scrutinizer For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

execute a .jil file

Hi All, Could anyone suggest me as to how could we execute a .jil file. Thanks in advance. (1 Reply)
Discussion started by: OSD
1 Replies

2. Shell Programming and Scripting

execute a .jil file

hello all, Could anyone please suggest me as to how could we execute a .jil file. Thanks in advance for your help. (4 Replies)
Discussion started by: OSD
4 Replies

3. Shell Programming and Scripting

How to convert excel file to csv file or text file?

Hi all, I need to find a way to convert excel file into csv or a text file in linux command. The reason is I have hundreds of files to convert. Another complication is the I need to delete the first 5 lines of the excel file before conversion. so for instance input.xls description of... (6 Replies)
Discussion started by: johnkim0806
6 Replies

4. Shell Programming and Scripting

Writing excel file using perl : Excel file formatting changed

I am trying to create a program where user can input data in certain excel cells using user interface on internet....the programming is on perl and server is unix But when i parse data into excel the formatting of sheets is turned to default and all macro coding removed. What to do...Please... (7 Replies)
Discussion started by: mud_born
7 Replies

5. Shell Programming and Scripting

Perl script to Merge contents of 2 different excel files in a single excel file

All, I have an excel sheet Excel1.xls that has some entries. I have one more excel sheet Excel2.xls that has entries only in those cells which are blank in Excel1.xls These may be in different workbooks. They are totally independent made by 2 different users. I have placed them in a... (1 Reply)
Discussion started by: Anamika08
1 Replies

6. Shell Programming and Scripting

awk to parse jil output

Hi , I have a jil file which i am trying to parse and print the job name and the condition corresponding to it. Below is the input file /* -------------------- testjob1 -------------------- */ insert_job: testjob1 job_type: c machine: unix owner: chidori condition: s(joba) and... (9 Replies)
Discussion started by: chidori
9 Replies

7. Shell Programming and Scripting

Parse excel file with html on each cell

<DIV><P>Pré-condição aceder ao ecrã Home do MRS.</P></DIV><DIV><P>OK.</P></DIV><DIV><P>Seleccionar Pesquisa de Recepção Directa.</P></DIV><DIV><P>Confirmar que abriu ecrã de Recepção Directa.</P></DIV><DIV> (6 Replies)
Discussion started by: oliveiraum
6 Replies

8. Shell Programming and Scripting

Script to generate Excel file or to SQL output data to Excel format/tabular format

Hi , i am generating some data by firing sql query with connecting to the database by my solaris box. The below one should be the header line of my excel ,here its coming in separate row. TO_CHAR(C. CURR_EMP_NO ---------- --------------- LST_NM... (6 Replies)
Discussion started by: dani1234
6 Replies

9. Shell Programming and Scripting

Need to extract jil file details in a excelsheet

I am very new to shell scripting. I have a autosys jil file that looks like :-- /* ------------- JOB1 ------------------ */ insert_job: JOB1 job_type: b owner: cm@pelonmuck permission: gx,ge,wx,we,mx,me date_conditions: 1 days_of_week: mo,tu,we,th,fr,su start_time: "18:30"... (9 Replies)
Discussion started by: newbie_shell
9 Replies
All times are GMT -4. The time now is 09:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy