Use the -i
flag to ignore case in the results.
Let’s return back to our handy test.txt
file and add “Happy” to the end:
sad
happy
awake
coffee
work
school
Happy
To ignore case differences run:
$ grep -i "happy" test.txt
happy
Happy
The uppercase variant is also an “ignore” flag, but this time we are ignoring binary files.
So if the current directory with test.txt
, also contained test.pdf
, the following would ignore the pdf file:
$ grep -I "happy" *
test.txt:happy