grep command
The Grep command will extract the matched string data from the target file.
Note: Grep, Egrep, Fgrep, Rgrep are all commands performing the same function i.e extracting the matched string data from the target input file in Command Line Interface, hence we discuss only the grep command here.
Syntax of grep command:
grep [options] pattern [files]
Sample code:
Let us create a text file that contains some sentences in text.
cat > files11.txt
Now, we will apply the grep filter on some text data in the above file to retrieve the desired value.
grep -i "ravi" files11.txt
Output:
Explanation:
Here, we are matching the particular string data with the contents of files11.txt.
Useful Commands For Filtering Text for Effective File Operations in Linux
In this article, let us learn about different commands used in Linux for filtering text to implement effective file operations on Linux Machines.
Contact Us