Extract the number of failures from a test report

view story

http://unix.stackexchange.com – How would I parse following output of lein test $ lein test lein test nepleaks-engine.core-test Ran 1 tests containing 1 assertions. 0 failures, 0 errors. Where I want is get number before failures using bash script. I only know better is grep, $ lein test | grep 'failures' | cut -d' ' -f1 0 Suggest me the better ways of doing this. (HowTos)