Search all files containing a specific string

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

Etienne Noumen

Sports Lover, Linux guru, Engineer, Entrepreneur & Family Man.

Recent Posts

A Daily Chronicle of AI Innovations in May 2024

AI Innovations in May 2024

3 hours ago

Tips for Ensuring Success Throughout Your Career

For most people, a satisfactory career is essential for leading a happy life. However, ensuring…

4 days ago

Different Career Paths in the Pipeline Industry

The pipeline industry is more than pipework and construction, and we explore those details in…

4 days ago

SQL Interview Questions and Answers

SQL Interview Questions and Answers In the world of data-driven decision-making, SQL (Structured Query Language)…

2 weeks ago

Things To Consider When Switching Internet Providers

Before you make the decision to switch your home’s interest service provider, take the time…

4 weeks ago

A Daily Chronicle of AI Innovations in April 2024

AI Innovations in April 2024. Welcome to the April 2024 edition of the Daily Chronicle,…

1 month ago