27.16 Faking Case-Insensitive SearchesThis may be the simplest tip in the book, but it's something that doesn't occur to lots of users. On many UNIX implementations, the egrep command doesn't support the -i option, which requests case-insensitive searches. I find that case-insensitive searches are absolutely essential, particularly to writers. You never know whether or not any particular word will be capitalized. To fake a case-insensitive search with egrep , just eliminate any letters that might be uppercase. Instead of searching for Example , just search for xample . If the letter that might be capitalized occurs in the middle of a phrase, you can replace the missing letter with a "dot" (single character) wildcard, rather than omitting it. Sure, you could do this the "right way" with a command like:
% But our shortcut is easier. This tip obviously isn't limited to egrep ; it applies to any utility that only implements case-sensitive searches, like more . - |
|