Reputation: 160
I am writing code which has to pick a specific line from the table.
I am trying to pick the line and then put in a file with the name result_X_Y.txt
.
I already tried $X
and $Y
.
Maybe there are some other options?
There is the line of code:
line=$(grep -F '21.581' cuted.txt | grep -F '54.6845')
this works very well when I put the numbers, but if I want to use these lines it does not work:
X=21.581
Y=54.6845
line=$(grep -F 'X' cuted.txt | grep -F 'Y')
Upvotes: 0
Views: 77
Reputation: 456
You using grep with word X and Y, but it not a variable.
Try it: line=$(grep -F "$X" cuted.txt | grep -F "$Y")
Upvotes: 1