1827809 Members
1944 Online
109969 Solutions
New Discussion

Re: find command

 
SOLVED
Go to solution
Marcel Boon
Trusted Contributor

find command

Hi,

I want to find a file called Pipo or pipo in the a directory. I don't know if it is in a uppercase or a lowercase or mix of it.

Which option do I have to use with the command find ? Or is there a other solution?

Marcel
See the man pages
8 REPLIES 8
Andreas Voss
Honored Contributor

Re: find command

Hi,

two solutions:

find . -name '[Pp][Ii][Pp][Oo]' -print

OR

find . | awk '{if(tolower($0)=="pipo")print $0}'

Cheers

Andrew
Victor BERRIDGE
Honored Contributor

Re: find command

Hi,
Have you tried:
find . -name PIPO -o -name pipo -o -name Pipo...

Regards
Victor
Marcel Boon
Trusted Contributor

Re: find command

Hi,

Thank you for your responce, but the file Pipo or pipo is a example-name for a file. I have a lot of filenames with upper or lowercases.
So, I want use the command in a script to search in directory's.

Marcel
See the man pages
Andreas Voss
Honored Contributor
Solution

Re: find command

Hi,

still more simply:
find . |grep -i pipo
Andreas Voss
Honored Contributor

Re: find command

Hi,

for multiple names:


find . |egrep -i '(pipo|papa|hello|whatever)'
Marcel Boon
Trusted Contributor

Re: find command

Uhhh....

I'm thought to different, I used the -exec command-option , that was not right.

Now I have asked a really stupid question .

Thanks
See the man pages
Alan Riggs
Honored Contributor

Re: find command

find is very system intensive if you want to search based just on filename. du is much faster and easier on resources. Use:

du -a [directory] | grep -i [filename]$

The $ is required only if you want to eliminate directories of the same name from your list.
Felix J. Liu
Advisor

Re: find command

Try this and see if it works for you:

find * | tr [A-Z] [a-z] | grep your_file_name

After see them in lower case, go to that dir and look for it.

Cheers