jeudi 30 avril 2015

Counting data that is valid to two conditions in columns 1 and 2

I am trying to run the following loop, the two while statements work, but the @ c awk line seems to be causing me some problems.

printf "" >! loop.txt

@ x = -125
while ($x <= -114)
    @ y = 32
    while ($y <= 42)
        @ c =`awk '{ for ($1 = $x*; $2 = $y*){count[$1]++}}' text.txt`
    printf "$x $y $c\n" >> loop.txt
    @ y++
    end
@ x++
end

With the awk line, I am trying to reference a file with lots of differing values in columns 1 and 2 of the text.txt file. I want to be able to firstly reference all of the values in column 1 that start with $x (as they all have several decimal places), then reference from that sub-list all of the values in column 2 that begin with $y. After this second sub-list has been formed, I would like to count all of the entries valid to those conditions. However, I keep getting syntax errors with the line, and I'm not sure that I'm using the correct function!

Aucun commentaire:

Enregistrer un commentaire