Using Grep Case Insensitive – POFTUT

Using Grep Case Insensitive

grep is very useful too to  match and find phrases, words and characters in test. One of the most used situation is using grep case sensitive or case insensitive. In this tutorial we will examine different examples. We have all ready examined grep in the following tutorial.

Linux grep Command Tutorial with Examples

Case Sensitive

We will start with the default behavior of the grep command which is case sensitive. In this example we will search for ismail in /etc/passwd .

Case Sensitive

Case Sensitive

Case Insensitive

Now we will search for ISMAIL in a case insensitive manner. We expect to match both ismail and ISMAIL in /etc/passwd file. We will use -i option in order to specify case insensitivity.

Case Insensitive

Case Insensitive

Case Insensitive and Recursive

In some cases we may need to search case insensitive and recursive manner. We will use -r option in order to make our case insensitive searchs recursively.  In this case we will search for ISMAIL case insensitive in /etc directory.

Case Insensitive and Recursive

Case Insensitive and Recursive

LEARN MORE  Java - Basics and Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)