How to search all files containing a specific string on Linux and Windows?
-
On Linux
grep -rnw ‘directory’ -e “pattern”
grep –include=\*.{txt,log} -rnw ‘directory’ -e “pattern”
This will only search for files with .txt or .log extension.
grep –exclude=*.txt -rnw ‘directory’ -e “pattern”
This will exclude files with .txt extensions.
-
On Windows
CD Location
FINDSTR /L /S /I /N /C:”pattern” *.log
The Cloud is the future: The AWS Certified Solutions Architect – Associate Average salary is $149,446/year. Get Certified Now with the apps below:
Get 20% off Google Workspace (including Google Meet) Business Plan (Americas): L9H4RENHLPH76FV
