So I basically have to assign (x,y) coordenates to some ids that will be coming from a file. Let's say the file items.txt
have the following content:
if-eth0-in
if-eth0-out
ping-status
cpu-load
Those ids are related to some graphs that will be ordered into a table. The table goes like:
column1 column2
row1 (0,0) | (1,0)
row2 (0,1) | (1,1)
row3 (0,2) | (1,2)
When I'm adding the ids to the table, I assign them their cordenates by changing the value of their x and y so first item would have x=0 && y=0 and the second one x=1 && y=0
So far I've been trying to do it by using a for
loop but I'm facing a problem that may have an easy solution using another language such as perl or python. Basically, I haven't been able to assign the correct value to y as it goes like:
item1: y=0
item2: y=0
item3: y=1
item4: y=1
and so on, while x goes like:
item1: x=0
item2: x=1
item3: x=0
item4: x=1
so there's no problem on changing that with a simple if
statement but I have no clue on how could I do it to manage the y value.