Hi All
I'm stuck on something and not sure what the problem is. This should be basic stuff but I'm not getting it to work.
All I want to do is run a small shell script against a file to test if the numbers match up. If they do, print PASS or if not FAIL.
The file I want to run against contains info like this:
No special characters that I can see and no whitespace on end etc.
The script:
This is sample output from that when run against the file:
So something is wrong on N2 .. its putting a value after the "." I'm using to test. It's also dropping a character.
Any ideas what the issue might be or a way around this?
Thanks in advance.
I'm stuck on something and not sure what the problem is. This should be basic stuff but I'm not getting it to work.
All I want to do is run a small shell script against a file to test if the numbers match up. If they do, print PASS or if not FAIL.
The file I want to run against contains info like this:
Code:
2293595,2293595
2293596,2293596
2293597,2293597
2293598,2293598
No special characters that I can see and no whitespace on end etc.
The script:
Code:
for N in `cat $1 | awk -F, '{print $1}' `
do
N2=`cat $1 | grep "$N" | awk -F, '{print $2}'`
## This section added to try debug issue
echo "$N" | wc
echo "$N."
echo "$N2" | wc
echo "$N2."
if [ "$N1" = "$N2" ]
then
echo "PASS"
else
echo " FAIL"
fi
done
This is sample output from that when run against the file:
Code:
1 1 8
2293595.
1 1 9
.293595
FAIL
1 1 8
2293596.
1 1 9
.293596
FAIL
1 1 8
2293597.
1 1 9
.293597
So something is wrong on N2 .. its putting a value after the "." I'm using to test. It's also dropping a character.
Any ideas what the issue might be or a way around this?
Thanks in advance.