regex, awk, grep question "how to"

I've been working on this for 2 days and I'm not getting far. It is time to turn to you guys.

With the data below, I am trying to create a file that looks like this: I'd like to use some form of egrep I think.

AY#box#P04prod_to_contingency s AY#cmd#P04dump_cont_db s AY#cmd#P04get_on_ice_job s AY#cmd#P04get_on_hold_jobs s AY#cmd#P04jobs_with_sched
or like this:
AY#cmd#P04load_db_into_shadow,s,AY#cmd#P04copy_cont_primary_ to_shadow

The Fields are all alpha. Field1 = Job, Field2 = cond_attr, Field3 = Con_Job
There is always one job but each job can have 0 to 10 cond_attr's, con jobs
The con_attr can = s or sucess, c or complete, d or done. In the example above the job starts with: insert_job: AY#cmd#P04copy_cont_primary_to_shadow
The condition starts 6 lines futher down: condition: s(AY#cmd#P04dump_cont_db)

Can anyone help??? I'll owe you big time.. Thanks

/* ----------------- AY#cmd#P04copy_cont_primary_to_shadow ----------------- */ 

insert_job: AY#cmd#P04copy_cont_primary_to_shadow job_type: c 
box_name: AY#box#P04prod_to_contingency
command: /export/apps/sched/local/contingency/bin/primary_cont_to_shadow.ksh
machine: vm_AY_P04_Shadow
owner: autosys
permission: gx
condition: s(AY#cmd#P04dump_cont_db) && s(AY#cmd#P04get_on_ice_jobs) && s(AY#cmd#P04get_on_hold_jobs) && s(AY#cmd#P04jobs_with_sched)
description: "Copy data dir from cont primary to shadow"
job_terminator: 1
std_out_file: >/export/apps/sched/local/contingency/logs/$AUTOSERV/$AUTO_JOB_NAME.out
std_err_file: >/export/apps/sched/local/contingency/logs/$AUTOSERV/$AUTO_JOB_NAME.err
alarm_if_fail: 1


/* ----------------- AY#cmd#P04load_db_into_shadow ----------------- */ 

insert_job: AY#cmd#P04load_db_into_shadow job_type: c 
box_name: AY#box#P04prod_to_contingency
command: /export/apps/sched/local/contingency/bin/load_shadow_cont_database.ksh
machine: vm_AY_P04_Prime
owner: autosys
permission: gx
condition: s(AY#cmd#P04copy_cont_primary_to_shadow)
description: "Load the cont primary DB into shadow"
job_terminator: 1
std_out_file: >/export/apps/sched/local/contingency/logs/$AUTOSERV/$AUTO_JOB_NAME.out
std_err_file: >/export/apps/sched/local/contingency/logs/$AUTOSERV/$AUTO_JOB_NAME.err
alarm_if_fail: 1


/* ----------------- AY#F8ADM#cmd#Weekly_Tactical_Dir_Bkup ----------------- */ 

insert_job: AY#F8ADM#cmd#Weekly_Tactical_Dir_Bkup job_type: c 
command: /export/apps/sched/log_archive/HOME_ACCTS/Tactical/Scripts/Tact-tar.ksh
machine: vm_AYF8-UNX_Admin
owner: autosys
permission: gx
date_conditions: 1
run_calendar: every_friday
start_times: "18:00"
description: "Bkup and Tar the Tactical directory every Friday"
term_run_time: 10
std_out_file: >/var/tmp/$AUTO_JOB_NAME.out
std_err_file: >/var/tmp/$AUTO_JOB_NAME.err
alarm_if_fail: 1

Try this solution:

awk -F": " '
/^insert_job: /{gsub(/ job_type:.*/,"");job=$2}
/^condition: /{gsub(/[)&(]/," ");gsub(/ +/," ");print job","$2}' infile

This worked great! Thx, now I have to figure out how you did it.

One more question - How do I remove the comma after the first field? This was the output of you code. Again Thx.

AY#cmd#P04copy_cont_primary_to_shadow,s AY#cmd#P04dump_cont_db s AY#cmd#P04get_on_ice_jobs s AY#cmd#P04get_on_hold_jobs s AY#cmd#P04jobs_with_sched
AY#cmd#P04load_db_into_shadow,s AY#cmd#P04copy_cont_primary_to_shadow