Friday, July 29, 2022

[SOLVED] Skip current directory, but allow all sub directories in grep

Issue

How do I skip grep searching files in the current directory, but search files in all the sub directories?


id='dv4'>

Solution

Use a wildcard that matches all the subdirectories as the argument.

grep -R pattern */

The / at the end forces it to only match directories (including symbolic links to directories).



Answered By - Barmar
Answer Checked By - Clifford M. (WPSolving Volunteer)