May 5, 2009, 6:09 pm
The grep command is regarded as one of the most essential building blocks of command line automation. It is a search tool that can be used to perform basic text filtering and processing tasks on files and streams. Although it is deceptively simple, it can sometimes take the challenge out of finding the proverbial needle in a haystack. In this article, I'm going to show you several examples of how it can be used to perform real-world tasks.
The most common and basic scenario of grep usage is a text search. It can be used to find instances of a word or phrase in files and text streams. You can invoke it at the command line by typing the command name, the search query, and the target files in which to search.