[grep][find] Find all files with my name AND a "TODO" somewhere in the code

By.

min read

My profile

Share this:

I was looking for a way to query all (php) files which did have my name (fincken) somewhere AND a “TODO” comment somewhere.

I posted my question on stackexchange yesterday:
http://stackoverflow.com/questions/25665103/how-to-grep-query-all-files-for-2-strings/

Getting a list of files:
[code:1:c58f77edd5]grep -Rl –include=”*php” “TODO” * | xargs grep -il “fincken”[/code:1:c58f77edd5]

Getting a list of files with every line of code having TODO in it:
[code:1:c58f77edd5]find -name ‘*.php’ | xargs grep -il ‘fincken’ | xargs grep -il ‘todo’ |xargs grep -in -e ‘todo’ -e ‘fincken'[/code:1:c58f77edd5]

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *