A grep command to search for a popular string in a vendor/ directory.
It aims to be more efficient (performance, readability) than what IDE commonly do :
grep -rlP 'sylius\.grid' vendor/ | grep -vP 'xml|Test|rst'
- Find all occurences in vendors
-r vendor/
with a regex-P
for 'syliusDOTgrid', 'DOT' being a real dot between 'sylius' and 'grid', but only display file names-l
to avoid dozens of matches being in those files - Pipe
|
results and excludegrep -v
with a regex-P
files containing 'xml', 'Test' or 'rst'xml|Test|rst
in their path, since these files usually have lots of occurences and not the golden piece of code you search for ;)
It remains simple to write and efficient, do you have other tips with grep?