Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

search a word in a text using grep in Linux

grep -Rw '/path/to/search/' -e 'pattern'
Desc: The -R flag sets grep to recursive mode, navigating through all the directories 
contained within the specified directory. The -w flag searches for whole word matches. This means that ‘red’ will match only ‘red’ surrounded by whitespace characters and not ‘redundant’ or ‘tired.’ The -e flag prefaces the pattern to search for. It supports regular expressions by default.
Source by www.maketecheasier.com #
 
PREVIOUS NEXT
Tagged: #search #word #text #grep #Linux
ADD COMMENT
Topic
Name
6+3 =