Computing.Net > Forums > Unix > how to validate a file content?

how to validate a file content?

Reply to Message Icon

Original Message
Name: Anu
Date: September 16, 2003 at 01:44:38 Pacific
Subject: how to validate a file content?
OS: Win 2000.
CPU/Ram: P IV & 64kb
Comment:

Hi,
i have file RESULT(containing table contents) with columns containing process number,ccod,etc
ccod is in 5th column
based on it validation has to be done i.e
if ccod =0(or)2(or)4A - success status else
if ccod = other than 0,2,4A - failure
success has to be passed to another TEMP file
loop continues to read another one

how should the korn scripts be?
can anyone help
thank u
Anu


Report Offensive Message For Removal

Response Number 1
Name: Sean Miller
Date: September 16, 2003 at 02:04:40 Pacific
Subject: how to validate a file content?
Reply: (edit)

Something like...

#!/bin/ksh

for ccod in `cat RESULT | awk '{ print $5 }'`
do
if [ $ccod = "0" || $ccod = "2" || $ccod = "4A" ]
then
echo "success" >> NEWFILE
else
echo "failure" >> NEWFILE
fi
done


Report Offensive Follow Up For Removal

Response Number 2
Name: Anu
Date: September 16, 2003 at 02:41:55 Pacific
Subject: how to validate a file content?
Reply: (edit)

Thank u so much


Report Offensive Follow Up For Removal

Response Number 3
Name: Sean Miller
Date: September 16, 2003 at 12:40:16 Pacific
Subject: how to validate a file content?
Reply: (edit)

Just tried this again, and I screwed up...

Should have said...

Something like...

#!/bin/ksh

for ccod in `cat RESULT | awk '{ print $5 }'`
do
if [ $ccod = "0" ] || [ $ccod = "2" ] || [ $ccod = "4A" ]
then
echo "success" >> NEWFILE
else
echo "failure" >> NEWFILE
fi
done



Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: how to validate a file content?

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software