I have a list
containing sublists.
list= {{-9, 3, 2}, {-9, 3, 8}, {-9, 4, 3}, {-9, 4, 4}, {-7, 2, 2}, {-7, 2,
10}, {-7, 3, 4}, {-5, 1, 16}, {-5, 2, 4}, {-3, 1, 4}, {-3, 1,
6}, {3, 1, -14}, {3, 2, -8}, {3, 3, -6}, {3, 4, -5}, {3, 6, -4}, {7,
5, -8}, {9, 10, -6}}.
I want to keep sublists whose first two elements match.
{-9, 3, 2}, {-9, 3, 8}, {-9, 4, 3}, {-9, 4, 4}, {-7, 2, 2}, {-7, 2, 10}, {-3, 1, 4}, {-3, 1, 6}
and merge these sublists into:
{{-9, 3, 2, 8}, {-9, 4, 3, 4}, {-7, 2, 2, 10}, {-3, 1, 4, 6}}
I would like to discard other sublists.
{-7, 3, 4}, {-5, 1, 16}, {-5, 2, 4},{3, 1, -14}, {3, 2, -8}, {3, 3, -6}, {3, 4, -5}, {3, 6, -4}, {7,5, -8}, {9, 10, -6}
.
I tried by my hand to get {{-9, 3, 2, 8}, {-9, 4, 3, 4}, {-7, 2, 2, 10}, {-3, 1, 4, 6}}
.
How can I tell Mathematica to do it?