For the first part you want Pick :
In[27]:= Pick[{{1,3,7},{2,4,6},{3,1,9}},{{0,2,4},{1,3,2},{2,0,4}},_?Positive] Out[27]= {{3,7},{2,4,6},{3,9}} In[28]:= Pick[{{1,3,7},{2,4,6},{3,1,9}},{{0,2,4},{1,3,2},{2,0,4}},_?(
For GatherBy second question GatherBy you like best:
In[29]:= x = GatherBy[{{{1, 2}, {1, 1}}, {{1, 3}, {2, 4}}, {{1, 2}, {2, 3}}, {{1, 4}, {3, 3}}}, First] Out[29]= {{{{1, 2}, {1, 1}}, {{1, 2}, {2, 3}}}, {{{1, 3}, {2, 4}}}, {{{1, 4}, {3, 3}}}}
And then you can apply the rule to clean things up a bit:
In[30]:= x /. l:{{a_, _}..} :> {a, Last /@ l} Out[30]= {{{1, 2}, {{1, 1}, {2, 3}}}, {{1, 3}, {{2, 4}}}, {{1, 4}, {{3, 3}}}}