How do you factor by grouping x^3 - x^2 + 2x - 2?

Yoou can collect $x$ between the first and third term and $- 1$ between the second and fourth to get:
$x \left({x}^{2} + 2\right) - 1 \left({x}^{2} + 2\right)$ now collect $\left({x}^{2} + 2\right)$:
$\left({x}^{2} + 2\right) \left(x - 1\right)$