When you’re searching for a text in a particular file under a Linux system you’re usually using the grep command. grep stands for Get Regular Expression and Print, in this article we’ll show several examples of how to use it:
grep "textToSearchFor" file.txt
grep -i "THIS CASING DOESN'T MATTER" file.conf
grep without matching
grep -v "thisWillNotBeMatched" file.txt
Usually, grep searches like how you would match a Regular Expression (as it’s in its name), if you would like to apply \b search you would use
grep -w "justThisWordWillBeMatched" file.cnf
grep -c "howManyTimesThisAppearsInTheFile" file.php
This will show the number of the line the match is found
grep -n "whichLineIsThisOn" file.txt
You can play around and use our SSH Shared Hosting Packages to master the Linux Grep Commands. Now with a great discount price – 40% OFF the regular price!