Find and change the lines in the file.

Hi Everyone,

I have a JIL (Job Information Language) Definition for Several Jobs in a file.
I would like to do the following:

insert_job: KS_INT_BIZ_INT   job_type: c
command: /home/filter/script.sh INT
machine: MACHINE
owner: filter
permission: gx,mx
date_conditions: 1
days_of_week: all
start_times: "12:00"
description: "REGION"
std_out_file: /home/filter/logs/KS_INT_BIZ_INT.`date +%Y%m%d`.log
std_err_file: /home/filter/logs/KS_INT_BIZ_INT_err.`date +%Y%m%d`.log
max_run_alarm: 30
alarm_if_fail: 1
profile: /home/filter/.autosys_profile
timezone: US/Eastern

...so on

So, i am trying to do the following for the command field i.e.:

command: echo " /home/filter/script.sh INT "

So If the command field exists then I need to include the echo " <whatever the field has > " in the command filed.

Could someone please tell me a nice / easier way to do this.

Really appreciate your help and thoughts on this.

sed 's#^command:\(.*\)#command: echo " \1 "#' myJILfile
1 Like

With awk..

awk -F: '/command: /{print $1 FS " echo \"" $2 " \" ";next}1' inputfile
1 Like

thanks a lot for your quick replies.

Appreciate your help.