megacolorboy

Back

Published on April 10th, 2021

Unix

Exclude directories while searching for a pattern in files

Looking for a specific text pattern in a directory but wanted to avoid some paths? Here's a quick command that you can try:Hope this helps you out!

1 minute read

Looking for a specific text pattern in a directory but wanted to avoid some paths? Here's a quick command that you can try:


grep -R --exclude-dir=path/to/directory 'some pattern' /path/to/search

Hope this helps you out!