Let's say I have a file that contains ordered pairs of data.
Example..
-10 -10
-10 -9
...
10 9
10 10
If I want to grep out a portion of this file, say from -5 -5 to 5 5, I would use grep but I am returning extra data such as -5 6 which is outside of my search. Here is the code I have but I could use some help with my grep term.
Has anyone seen a problem like this before?
Thanks.
Example..
-10 -10
-10 -9
...
10 9
10 10
If I want to grep out a portion of this file, say from -5 -5 to 5 5, I would use grep but I am returning extra data such as -5 6 which is outside of my search. Here is the code I have but I could use some help with my grep term.
Code:
#!/bin/bash
for ((x=-5; x<=5; x++))
do
for ((y=-5; y<=5; y++))
do
grep -- "$x $y" file
done
done
Thanks.
Last edited: