Lessons · Terminal · when a pipeline prints nothing
Nothing is an answer
Every stage handles empty input gracefully, so an empty result travels all the way to the end without complaint.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
An empty report and a working report look identical to a scheduled job.
How to think about it
Take stages off the end until something appears. The first stage that empties it is the one to look at.
Worked example
grep zzz access.log | sort | uniq -cNothing, all the way through.
grep zzz access.log | wc -l0 -- the same emptiness, counted.
grep 500 access.log | wc -l2. So the pipeline works; the pattern was the problem.
Your turn
Count the lines matching something that is not there.
grep zzz app.log | wc
Try it at a real prompt
The trap
A daily report that prints nothing needs somebody to be told. Silence is not a status.
Practise when a pipeline prints nothing on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.