Loop Problem

Hi ,

I have a file like this

parentid process id
45 3456
1 7898
45 7890
1 6789
45 7597

now i need to loop through this and if parentid != 45 , then i ned to kill this process.

How to go through this is a problem.

what i thought is this--

while read line
 do 
    if [ parentid -ne 45 ];
        then
              kill -9 processid
   fi
 done


Thanks

2 Examples:

#!/usr/bin/ksh

sed -n '1!p' infile |\
while read NUMBER PID; do
        if (( $NUMBER != 45 )); then
                echo "I would kill $PID!"
        fi
done
awk 'NR > 1 && $1 != 45 { print $2 }' infile| xargs -I {} echo "I am about to kill" {}
I am about to kill 7898
I am about to kill 6789

sh

#!/bin/sh

while read line
 do
    hz=`echo $line | awk '{ print $1 }'`
    pid=`echo $line  | awk '{ print $2 }'`
        if [ $hz -ne 45 ];
         then
                kill $pid
        fi
 done < infile

Thanks Zaxxon.

I appericiate your quick response.

Regards,
Namish

#!/bin/ksh93

first=1
while read ppid pid
do
   if ((!$first)); then 
        (($ppid != 45)) && print "I would kill $PID!"
   fi
   first=0
done < file
awk '$1 != "45" { cmd="kill -9 "$2;system(cmd)}' file