What I'm trying to accomplish:
Search for the regular expression
\b\$\w+ in all
.php files that fall under this directory structure:
foo/templates/*.php bar/templates/*.php <something>/templates/*.php
Edit: I should state that my higher-level goal is to find unique PHP variables within files
What I tried:
grep '\b\$\w+' **/templates/*.php grep '\b\$\w+' */templates/*.php grep '\b\$\w+' **/templates/**.php
None of them seem to produce the expected results. What is the correct syntax to do this?
Additionally it would be nice to "group by" or "select distinct" (so for instance
$_GET would only show up once even if there's 180 instances in the file) if that's possible.
I've already read these answers which led me to try the above commands: