Grep exclude folder and search using linux

grep, linux

Solution

You can also use grep -v "/foldername/". -v takes away all matches.

grep -r string /var/www/ | grep -v "/exclude/"

Problem

grep command if I am in ``` /var/ ``` I want to search `/var/www` recursively but not ``` /var/www/exclude ```

Original source