How can I turn this ugly output into pretty, useful data?
The output:
/* ---------- TA#box#AbC_p ---------- */
insert_job: TA#box#AbC_p job_type: a
#owner: bob
permission: gx
date_conditions: 1
days_of_week: su
start_times: "16:15"
run_window: "16:15-17:30"
description: "Job AbC that runs at 4:15PM on Sundays, and should end before 5:30PM"
/* ---------- TA#cmd#EfGJob_p ---------- */
insert_job: TA#cmd#EfGJob_p job_type: b
box_name: TA#box#AbC_p
command: /path/to/shell/script.sh
machine: vm_machine1
#owner: alex
permission: gx
date_conditions: 2
run_window: "16:20-16:30"
description: "job EfG that runs within box AbC"
term_run_time: 60
std_out: /path/to/log.log
std_err: /path/to/err.log
alarm_if_fail: 1
profile: /path/to/profile
and so on, for a long time. #cmd# jobs are sometimes under a #box#. If they are under a #box#, the #cmd# section is indented.
My ideal output would be something like:
"Job Name", "Time", "Schedule", "Machine", "Description", "Command"
"TA#box#AbC_p", "16:15", "su", "", "Job AbC that runs at 4:15PM on Sundays, and should end before 5:30PM", ""
"TA#cmd#EfGJob_p", "16:15", "su", "vm_machine1", "job EfG that runs within box AbC", "/path/to/shell/script.sh"
I'm trying awk, perl and grep, but I'm having trouble keeping all the info for one "section" together before I print the CSV line.
title: TA#box#AbC_p(\n)insert_job: TA#box#AbC_p(\n) job_type: a(\n)#owner: bob
the (\n) is not actually printed, but my comments don't seem to show up properly here.. So if this output is easier to handle, let's work with this one.#cmd#
is not under a box, where does it get the properties that it inherits from#box#
? Do they simply appear in the cmd? For instance, will cmd have a days_of_week?