grep -e "Test total=[0-9][0-9]*$" -e "Test scored=[0-9][0-9]*$" -e "Tests failed=[0-9][0-9]*$" foofile
Considerando que você pretende unir as três primeiras linhas da entrada abaixo:
Test total=100
Test scored=80
Tests failed=0
Test total=100 alpha
Test scored=80 beta
Tests failed=0 gamma
Test total=
Test scored=
Tests failed=