Linux - Searching within Files
In Bash, we can search for words within files that match a certain pattern using the grep command. What if you wanted to know of a certain file existed in a directory, or if a word was in a file? Similar to the PowerShell select bash string command. We can use the grep command in Bash. Let’s search for the word cow in farm animals.
You’ll see that grep found cow in the text file farm animals. You can also use grep to search through multiple files.
Let’s use their asterisk wildcard command here, and you can see that it found cow in farm animals and ranch animals.
