Lessons · Terminal · grep -i: however it was typed
However it was typed
-i ignores case, which is usually right for anything a human wrote and wrong when the case IS the fact.
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
Logs written by several services spell the same level three ways.
How to think about it
Default to -i on human text; leave it off when ERROR and Error mean different things.
Worked example
grep -c error mixed.log1. Only the lowercase one.
grep -ci error mixed.log3. Flags combine, and -c is still lines.
grep -i error mixed.logAll three, so you can see what you counted.
Your turn
Find log however it was capitalised.
grep LOG app.log
Try it at a real prompt
The trap
On a log that uses ERROR for failures and Error for warnings, -i merges the two things you were asked to tell apart.
Practise grep -i: however it was typed on HoneA question on it now, a coding challenge where there is one, and it is remembered for review. Free, no email needed.