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
This is the inputfile:
$ more MapaRep.txt
ds_extra_nikira_usuarios
ds_extra_ordenesserv
ds_extra_recargajuste
ds_extra_score_dinamico
ds_ftp_ciclo_migr_05
This is the script
[validate_process
#!/bin/ksh
for i in `cat \home\autosys\MapaRep.txt`
do
autorep -J $i -q
done]
the output is something like listing n jobs name proprties
/* ----------------- ds_extra_nikira_usuarios ----------------- */
insert_job: ds_extra_nikira_usuarios job_type: c
box_name: ds_rep_nikira
command: /archivos/Shells/dwhExtraNikiraUsuarios.sh
machine: proetldb01c
owner: dsadm@proetldb01c
permission: gx,wx,mx
date_conditions: 1
days_of_week: all
start_times: "13:00"
alarm_if_fail: 1
max_exit_success: 2
/* ----------------- ds_extra_ordenesserv ----------------- */
insert_job: ds_extra_ordenesserv job_type: c
box_name: ds_rep_nikira
command: /archivos/Shells/dwhExtraccion.sh ordenesserv
machine: proetldb01c
owner: dsadm@proetldb01c
days_of_week: all
start_times: "12:00"
condition: d(ds_extra_recargajuste) & s(dwh_finalizacion)
description: "Genera el plano hacia nikira ORDENES_SERV_ en /archivos/InputFiles"
alarm_if_fail: 1
max_exit_success: 2
Is is OK up to know but i want to extract some data for each job sorted and formated as below:
insert_job command machine
ds_extra_ordenesserv: /archivos/Shells/dwhExtraccion.sh ordenesserv proetldb
..
job n name /command.sh n server n
awk: can't open ds_extra_nikira_usuarios
awk: can't open ds_extra_ordenesserv
awk: can't open ds_extra_recargajuste
awk: can't open ds_extra_score_dinamic
So Ive got some questions:
why Ive got this error
I know the output of autorep command is not tabulated, so its neccessary to debug this output by trimming blanks spaces or sth like that before being proccessed ?
any other sugesstions according to your expertise or knowledege ?
Is it possible your sample did not represent the real data? Try adding /^$/ {next} before the HD ~ $1 .
Should that not work, try modifying / commenting out script lines around line 5.
Thanks for your support, but ive got some questions:
1st /^$/ {next} before the HD ~ $1
would it be this way:?
/^$/ {next} HD ~ $1
what are we tryng to do with this line?
2nd try modifying / commenting out script lines around line 5
would it be commenting out lines 4 and 6?
what are we trying to do ? debug every line to trap the error ?
3rd dont konw about awk arrays and before i get documented and have a deeper knowledge, could u please explain to me a little bit about code lines ?
with your explanation i would have a better perspective to debug error i think
Please show us your complete current script (in CODE tags). There have been several suggestions on changes that could be made to your script and I am no longer sure that I know what your current script is doing.
Please show us the output that is being fed into the awk script (in CODE tags) from the autorep command. (Run the autorep command manually with the arguments it is given in the script and redirect the output to a file. Then show us the contents of that file.)
With that output from your autorep program, it is highly likely that nawk is very picky and doesn't like to match HD to the (empty) $1 . Try putting /^$/ {next} into the line just above the HD match, and post the result.