I thought I found the perfect answer with How do I find all files containing specific text on Linux?, so I tried it:
[Michael@devserver ~]$ grep -rnw '/var/www/concrete5.7.5.9/' -e "ConcreteCoreBlockBlockController" [Michael@devserver ~]$
None show, but I know there should have been a match.
[Michael@devserver ~]$ grep -rnw '/var/www/concrete5.7.5.9/concrete/blocks/html' -e "BlockController" /var/www/concrete5.7.5.9/concrete/blocks/html/controller.php:5:use ConcreteCoreBlockBlockController; /var/www/concrete5.7.5.9/concrete/blocks/html/controller.php:7:class Controller extends BlockController [Michael@devserver ~]$
I also tried escaping the backslash to no avail.
[Michael@devserver ~]$ grep -rnw '/var/www/concrete5.7.5.9/' -e "Concrete\Core\Block\BlockController" [Michael@devserver ~]$
Also tried single quotes to no avail.
[Michael@devserver ~]$ grep -rnw '/var/www/concrete5.7.5.9/' -e 'ConcreteCoreBlockBlockController' [Michael@devserver ~]$
How to find all files containing specific text which includes a backslash on Linux?
Advertisement
Answer
Use single quotes and escape backslash.
grep -rnw '/var/www/concrete5.7.5.9/' -e'Concrete\Core\Block\BlockController'