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

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

how to validate a file content?

Reply to Message Icon

Name: Anu
Date: September 16, 2003 at 01:44:38 Pacific
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



Sponsored Link
Ads by Google

Response Number 1
Name: Sean Miller
Date: September 16, 2003 at 02:04:40 Pacific
Reply:

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


0

Response Number 2
Name: Anu
Date: September 16, 2003 at 02:41:55 Pacific
Reply:

Thank u so much


0

Response Number 3
Name: Sean Miller
Date: September 16, 2003 at 12:40:16 Pacific
Reply:

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



0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: how to validate a file content?

How to delete a file named -x www.computing.net/answers/unix/how-to-delete-a-file-named-x/3350.html

How to parse a file of 199 col? www.computing.net/answers/unix/how-to-parse-a-file-of-199-col/7250.html

how to replace a file in a .zip fil www.computing.net/answers/unix/how-to-replace-a-file-in-a-zip-fil/7497.html