1825950 Members
3274 Online
109690 Solutions
New Discussion

Help read a file

 
Anand_30
Regular Advisor

Help read a file

Hi,

Please find attached a file which has the process ID and the process name.

I have to read this file and skip the rows which has the process ID 'Killed'.

Can anyone please help me.

Thanks,
Andy
3 REPLIES 3
V.Tamilvanan
Honored Contributor

Re: Help read a file

Hi,

#grep -v killed
Sridhar Bhaskarla
Honored Contributor

Re: Help read a file

Hi Andy,

This file has hardly anyline. YOu can simply edit this file, search for "killed" and delete them.

Ofcourse 'grep -v killed file' will get to it.

I wonder if it is what you wanted. Can you elaborate it?

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Steven E. Protter
Exalted Contributor

Re: Help read a file

In case you have to read the whole file

while read -r a b c d e f g #however many fields
do
if [ "$g" = "killed" ]
then
# ignore
else
do something else
fi

done

Otherwise grep -i -v killed will work

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com