find only for files

Hi,

I have more 1000 files in my home directory. I want to find out only the file name. which are having my pattern match.

Please advice the same.

Thanks,
Mani

$ grep -l "pattern" filelist_input
find $HOME -name 'GLOB_PATTERN'

or (GNU find only?):

find $HOME -regex 'REGEX_PATTERN'

Hi Yazu, Both are not working . Please advice on this

Ooh... What's your pattern?

Try

find /home/DiReCtOry -type f | grep "FiLeNaMe"

Use grep -i "FiLeNaMe"                       --> If doubt in case of name [cap letter / small letter]
Use grep -iE "FileName1|FileName2"    --> for Different files at a time.

Try

grep -rHwi "woRdToseArcH" /path        --> same as the above command.

Again need more ::
find - Wikipedia, the free encyclopedia

Do you mean you want to only find those files that contain a pattern in their name?
Or do you mean you want to only find those files that contain the pattern in their content?
What about case sensitivity?
Do you want to search in subfolders too?

By now you should have realized that you have to be specific with your questions, or it will take forever to get the answer you needed.

mani,

if you have problems like this, please give proper Examples. It will be easy to you and others to find out the solution.

Yes. I want to find out only file name.
Example: which file contains my name as Mani
lot of sub directory also available.

find - Wikipedia, the free encyclopedia
Example of search for "LOG" in jsmith's home directory

find ~jsmith -exec grep "LOG" '{}' /dev/null \; -print

Output
/home/jsmith/scripts/errpt.sh:cp $LOG $FIXEDLOGNAME
/home/jsmith/scripts/errpt.sh:cat $LOG
/home/jsmith/scripts/title:USER=$LOGNAME

Does the file name contain Mani, or does the file itself contain that string? Or should both be checked? You might want to read How To Ask Questions The Smart Way

Mani,

Try this command out...this will list the filenames that has your name.

find / -type f -exec grep -l Mani { } \;

 
find . -type f | xargs grep -l "Mani"