Test a pipeline one stage at a time
Run the first stage, then add the next, then the next. Each stage's output is visible, so a wrong answer is found at the stage that introduced it rather than guessed at the end.
Errors go on a different stream
2> sends errors to a file and 2>&1 folds them into the normal output. A pipeline that produces nothing may have failed loudly on the error stream, which is why capturing both is worth the extra characters.