Unix/Linux – Putty Use: Case Insensitive Search in Logs

Most of the time, we developers (even Testers too) think of exact string error whenever exception occurs. We log-in through Putty (or any other SSH client) and hit the following to look for look up string–

1. Open Putty.

2. Log-in to node on which error needs to search on.

3. Go to log location. log file

4. Open log file in VI editor by – vi <Name_of_Log_File>

5. Press Shift + G (This command take the editor pointer to last line in log file).

6. Write this- ?<Lookup_String>.

7. Press n for next occurrence.

This will return to only those string which has exact match. What if you don’t remember the exact string or you have lack of time. Unix provide useful command for this situation.

Simply write this: ?<Lookup_String>\c

This will perform case-insensitive search. Isn’t cool?

There is also another way to perform case-insensitive search:

In vi mode write this–

:set ignorecase

Now for every – ?<Lookup_String>, the search is case-insensitive.

I prefer to use \c, its quite handy. What do you think?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s