Search for Text in Files, Ignoring Case


-i

By default, searches performed with grep are case-sensitive. In the previous section, you searched amongst H.P. Lovecraft stories for the word hideous (a favorite of that author). But what about Hideous?

$ grep Hideous h_p_lovecraft/* h_p_lovecraft/the_whisperer_in_darkness.txt: them. Hideous though the idea was, I knew... 


Your earlier search for hideous found 463 results (wow!) and Hideous returned one. Is there any way to combine them? Yes, with the -i (or --ignore-case) option, which searches for both, and also searches for HiDeOuS, HIDEOUS, and all other possible combinations.

$ grep -i hideous h_p_lovecraft/* h_p_lovecraft/Call of Cthulhu.txt:voodoo meeting; and so singular and hideous were the rites h_p_lovecraft/Call of Cthulhu.txt:stated, a very crude bas-relief of stone, comprising a hideous h_p_lovecraft/the_whisperer_in_darkness.txt: them. Hideous though the idea was, I knew... 


Keep in mind that you're probably increasing the number of results you're going to get, perhaps by an order of magnitude. If that's a problem, check the tip at the end of the previous section for some advice about dealing with it.



Linux Phrasebook
Linux Phrasebook
ISBN: 0672328380
EAN: 2147483647
Year: 2007
Pages: 288

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net