Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm writing a module for drupal. Its functionality is contingent on the directory name, certain file names, and function names being identical.

I'm troubleshooting now, and I wanted to to a search to see that I had an identical string in all the places I needed it to be, but I realized I would be missing the directory name and filename! Is there a way to do a grep or something that would search all that information?

For example, if my module was named string, I would need

string/
string/string.module
  function string_function1() {...}
  function string_function2() {...}

If I did my everythinggrep string . and I saw

string/
  function string_function1() {...}
  function string_function2() {...}

I would know that I had misnamed my module file.

share|improve this question
    
Would the file actually be string.module? –  k.parnell Oct 6 '11 at 18:57
    
@k.parnell Yes. The directory name, the first part of the file name, and the first parts of function names must all be identical. –  user394 Oct 6 '11 at 20:10

1 Answer 1

up vote 3 down vote accepted

Not in a single statement, but in two statements:

For searching in text-files:

grep -RI "string" directory/*

For finding file-names:

find directory -type f -name "*string*" -ls
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.