process field 1 depending on field 6

Hi

I am abigginer to unix .I have a file which contains data like this .

fiusdcanlt_fmrbgmusd1_run    07/23/2012 20:11:18  07/23/2012 20:12:20  SU 10861341/1
fiusdcanlt_fmrbgmusd2_run    07/23/2012 20:12:22  07/23/2012 20:21:26  SU 10861341/1
fiusdcanlt_fmrbgmusd3_run    07/23/2012 20:34:18  07/23/2012 20:34:56  SU 10861341/1
fiusdcanlt_fmrbgmusd4_run    07/23/2012 20:48:13  07/23/2012 20:54:54  SU 10861341/1
Timecheck 20:30 EST
fiusdcanlt_fmrcmousd1_run    07/23/2012 21:05:54  07/23/2012 23:52:40  SU 10862038/1
fiusdcanlt_lbecalusd1_run    07/23/2012 20:07:06  07/23/2012 20:09:32  SU 10861218/1

Now I want to iterate through each line .The first column is job and 6 th column is job status.If the job status is success then script has to do nothing. But if the job status is IN ,then it has to take the job name and execute the the command jd job_name;

please help .what I am trying to acheive here is I need to process through the each line ,and depending on the status of field (job status ) i need to process the field 1 (jobname).

while read a b c d e f g
do
    if [ "$f" == "SU" ]
    then
        continue
    elif [ "$f" == "IN" ]
    then
        jd $a
    fi
done < inputfile
 
awk '$6~/^IN$/{print $1}' input.txt | while read jobname; do jd $jobname;done
awk '$6=="IN" {system("jd " $1 " >> /some/directory/logfile")}' inputfile 

HI Thanks for the replies;Really they are great .I got a problem .I have autosys installed on my server and running.Now in the script when i write the command Jd job_name ,it is saying jd is invalid command .But if I gove the same command in the command prompt it is giving the result .can you shed some light and advise ?

use the below command, instead of jd

 
awk '$6~/^IN$/{print $1}' input.txt | while read jobname; do autorep -q -J $jobname;done

Hi Thanks for the reply .
autorep -q -J is equivalent of JR commnad in autosys.
the correct commad we should use is jd job_depends -c -w -j job_name .

af      autorep -Jfi_ude%box|grep FA
aj      (autorep -Jfi_ude%box)
aq      (autorep -q -J)
cjs     (sendevent -ECHANGE_STATUS -sSUCCESS -J)
cls     clear
ct      /usr/atria/bin/cleartool
fsj     (sendevent -EFORCE_STARTJOB -J)
h       history
home    (cd /itf/ude)
ia      sendevent -eCHANGE_STATUS -sINACTIVE -J
jd      job_depends -c -w -j
jh      sendevent -E JOB_ON_HOLD -J
joh     sendevent -E JOB_OFF_HOLD -J
jr      autorep -w -J
jw      /itf/ude/jobwatch.csh
kj      (sendevent -EKILLJOB -J)
ll      ls -lga
lsd     ls -lga | grep drw
ltr     ls -ltr
mr      (autorep -M)
se      (sendevent -E)
sj      (sendevent -E STARTJOB -J)

Again many thanks for ur reply.

Hi when tried the command

 
 
 awk '$6~/^IN$/{print $1}' my_temp.txt

It is not giving any jobs that are in IN state.It is only working with Su status .
can u pls chekc and confirm .

 
awk '$6~/^SU$/{print $1}' my_temp.txt
fiusdcanlt_fmrbgmusd1_run
fiusdcanlt_fmrbgmusd2_run
fiusdcanlt_fmrbgmusd3_run
fiusdcanlt_fmrbgmusd4_run
fiusdcanlt_fmrcmousd1_run
fiusdcanlt_lbecalusd1_run
fiusdcanlt_fmrslusd1_run
fiusdcanlt_fmrcmbsusd1_run
fiusdcanlt_fmrtbausd1_run
fiusdcanlt_fmrcalusd1_run
ficadcanlt_sccalcad1_run
ficadcanlt_fmrcalcad1_run
ficadcanlt_fmrcmbscad1_run
ficadcanlt_bcgcalcad1_run
fiusdcanlt_fmrfmmusd1_run
fiusdcanlt_lbtcalusd1_run
fiusdcanlt_fmrbmmusd1_run
fiusdcanlt_fmrtbausd2_run
fiusdcanlt_fmrmcrusd1_run
fiusdcanlt_fmrfrmusd1_run
fiusdcanlt_lbtcmbsusd1_run
fiusdcanlt_cgfrmusd1_run
fiusdcanlt_cgcalusd1_run
fiusdcanlt_lbtcalusd2_run
fiusdcanlt_lbmcalusd1_run
fiusdcanlt_lbtfrmusd1_run
fiusdcanlt_fmrcmousd2_run
fiusdcglba_cgcalglb_run
fiusdcglba_fmrcalglb1_run
fiusdcanlt_fmrfrmusd2_run
fiusdcanlt_fmrcalusd2_run
fiusdcanlt_fmrfmmusd2_run
ficadcanlt_fmrcalcad2_run
ficadcanlt_fmrfmmcad2_run
fiusdcanlt_fmrpdwusd1_run
fiusdcglba_fmrcalglb2_run
fiusdcglba_fmrcmbsglb2_run
fiusdcglba_fmrfrmglb2_run
fiusdcglba_fmrhecmglb2_run
fiusdcglba_fmrcmoglb2_run
fiusdcacct_swap_prcs_run
fiusdcanlt_fmrmmmusd1_run
fiusdcanlt_fmrmlrusd1_run
ficadcanlt_fmrmlrcad1_run
ficadcanlt_fmrmmmcad1_run
fiusdcglba_fmrcmoglb3_run
fiusdcoutb_saifrmusd1_run
ficadcanlt_scdascad1_run
ficadnanlt_fmrdascad1_run
fiusdnanlt_lbtdasusd1_run
fiusdcvref_bbg_normal_box
[udeitf@fiappl18dev prabhu]$ awk '$6~/^IN$/{print $1}' my_temp.txt
[udeitf@fiappl18dev prabhu]$ awk '$6~/^RU$/{print $1}' my_temp.txt