I want to do multiple comparisons on a series of numbers from an array:
I send the numbers in file1 through want to print out some info from file2 based on some conditions.
The syntax just isn't correct???
awk '
NR==FNR{
a[NR]=$0
next
}
{
for(i=1;i<NR;i++)
if (a [i]< $7 && a [i]> $8) print $1,
if (a [i]< $8 && a [i]> $9) print $2,
if (a [i]< $5 && a [i]> $4) print $3,
Not sure what you're trying to do here (sure seems to me that there are easier methods) but, for starters, you may want to reference your filenames in your awk procedure blocks or it's going to get messy.
awk '
NR==FNR{
a[NR]=$0
next
}
{
for(i=1;i<NR;i++) {
if (a < $7 && a > $8) print $1,
if (a < $8 && a > $9) print $2,
if (a < $5 && a > $4) print $3,
}
}' file1 file2 > outfile &