Posts

Showing posts from April, 2016

Information filtering using grep commands

While I was working on monitoring the long running test issues, I thought it would be useful to write a post on the usage of 'grep' commands in Linux.

In this article I will be discussing few real examples of using "grep" commands and how to execute grep commands as a shell script.

Search for a given string  This command is use to search for specific string in a given file.
grep "<Search String>" <File Name>
Ex: In the below example, it will search for the string "HazelcastException" within wso2carbon.log file.
grep "HazelcastException" wso2carbon.log
Search for a given string and write the results to a text file This command is use to search for a given string and write the search results to a text file.
grep "<Search String>" <File Name> > <Text File Name>
Ex: In the below example, it will search for the string "HazelcastException" within wso2carbon.log file and write the search res…