# Move variables of a certain degree to one side of an equation

I have an equation x^2 + 2x + 1 + y^2 + 4y + 4 == 20 and I want it so that only the linear terms are on the left and the constants and squared terms are on the right. Is there an easy way to do this?

Update: Generalizing to a function that takes the degree of the LHS terms as argument:

ClearAll[termS, lhS]
termS[e_: 1] := Select[Exponent[# /.
Alternatives @@ Variables[#] -> \[FormalT], \[FormalT]] != e &];

lhS[e_: 1] = SubtractSides[#, termS[e]@First@#] & @* SubtractSides;


Examples:

eqn1 = x^2 + 2 x + 1 + y^2 + 4 y + 4 == 20;
eqn2 = x^2 + 1 + y^2 + 4 y + 4 == 20 - 2 x;
eqn3 = t^2 + Pi^5 + y^2 + 4 y + 4 == 20 - 2 t;

lhS[] @ eqn1

2 x + 4 y == 15 - x^2 - y^2

Grid[Prepend[Join @@ Table[{i, ## & @@ Riffle[List @@ #, "=="], ## & @@
Riffle[List @@ lhS[i]@#, "=="]} & /@ {eqn1, eqn2, eqn3}, {i, 0, 2}],
{"i", "eqn", SpanFromLeft, SpanFromLeft, "lhS[i]@eqn", SpanFromLeft, SpanFromLeft}],
Dividers -> {{True, True, False, False, True, {False}, True}, All},
Alignment -> {{Center, { Right, Center, Left}}, Center,
{{1, 2} -> Center, {1, 5} -> Center}}] ClearAll[linearLHS]
linearLHS = SubtractSides[#,
Select[Exponent[# /.
Alternatives @@ Variables[#] -> \[FormalT], \[FormalT]] != 1 &] @ First @ #] & @*
SubtractSides


Example:

eqn1 = x^2 + 2 x + 1 + y^2 + 4 y + 4 == 20;
linearLHS @ eqn1

 2 x + 4 y == 15 - x^2 - y^2

eqn2 = x^2 + 1 + y^2 + 4 y + 4 == 20 - 2 x;
linearLHS @ eqn2

2 x + 4 y == 15 - x^2 - y^2

eqn3 = t^2 + 1 + y^2 + 4 y + 4 == 20 - 2 t;
linearLHS @ eqn3

2 t + 4 y == 15 - t^2 - y^2

eqn = x^2 + 2 x + 1 + y^2 + 4 y + 4 == 20;

linear = First[eqn] /. Power[x|y, _] -> 0
SubtractSides[eqn, First[eqn] - linear]


This method finds the linear part by simply zeroing out the terms that contain $$x$$ or $$y$$ raised to a power. Then it subtracts the non-linear terms from both sides.