0

I have numerous variables within different php files, and I just want to list them in my terminal.

I guess the command begins with 'cat file.php file2.php' and ends with '| sort | uniq' but I failed finding a pattern that matches a variable, and I have no idea how to cut them from the rest of the line..

Thanking you in anticipation

1
  • google "php cross reference" Commented Jul 15, 2014 at 16:50

1 Answer 1

1

You could try this:

egrep -o '\$\w+' *.php | sort -u

Variables start with $ and are followed by alphanumeric charaters.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks so much, and I will pay more attention to the tags I set, next time :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.