Search file in all directories.

Hi colleagues,

I need to search one file in all dierctories, i have O.S. AIX 5.3, my file began with cc, the others caracters i unknow.

Then i can to search one string in file in all dierctories.

Thank you for advanced.

 
find /directory/name -type f -name "cc*" 2>/dev/null

If i like search string in all file all directories how to do?

Thank you.

what is mean by all file all directories ?

the given command will search the file from the directory you have given.

if you give as / (root) then it will search from root

On most systems there will be system files and programs starting with the letters cc . You will be best advised to only search user directories where you know that "cc*" can only match text files.

search="my search string"
find /directory/subdirectory -type f -name "cc*" 2>/dev/null | while read filename
do
           # Search file for string
           grep "${search}" "${filename}"
done

If you need to search system directories the script will need a higher level of sophistication such that it only searches text files.

all file all directories mean search from / open all directories and search in all files the string to search for.
Thank you for you help.

Binary executables are unsuitable for searching for text strings.
Are these files called cc* all owned by one non-root user? i.e. Is there some simple way of avoiding searching through binary executables on your system?

I say cc* as an example but will be search the string cc* in all type file .txt.

Thank you.

Pleaase give a simple example which matches your most recent post.

In unix there is no special meaning to ".txt". This is not MSDOS. If your files are called "*.txt" this does make the script easier to write.