Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Comparing wc outputs using array

$
0
0
Hi All,

Im trying to compare the
Code:

wc -l
output with another set of rowcount outputs which returned from sql...

For Eg : Im storing the first outputs as below
Code:

<srccnt=`wc -l $HOME/*.csv | awk {'print $1'}`
and comparing this with the another set of outputs.
Code:

descnt=`seclect count(*) from tables..
I have to do this comparison for each counts.

for eg,
Code:

srccnt
retunrs 10 rows and
Code:

descnt
returns another 10 rows.. I have to compare if each row is matching or not.

Can you help this with script.

I have tried this but not returning any outputs

Code:


testcount(){
if [ "$srccnt" == "$descnt" ]; then
echo "Count Matches">>$LOG
retval=0
else
echo "MISMATCH">>$LOG
retval=1
fi
}


Viewing all articles
Browse latest Browse all 16232

Trending Articles