H.J.Bathoorn wrote:
On Wednesday 24 May 2006 03:29 pm, Neill Jones wrote:
  
 Just for info and clarity:

 A minor extra to H.J.Bathoorns post ... in the above, it is not the
 -iname which causes
 problems with the spaces, it is the use of xargs. For example,

 find . | grep "filename"

 works as pointed out by Harm. Also

 find . -iname "*.txt" | grep "filename"

 will work with all .txt files found. In both cases this can be
 understood since find returns
 each find item with a new line after it. grep then just reads each line
 of standard in which
 is a full line with the file name on it. When these are combined
 together as parameters for
 xarg however the spaces are seen as parameter breaks and so cause
 problems. Then you need to use the -print0 and xargs -0 options.

Reading theman-pages one would expect so but ....... on none of my boxes do 
filenames with spaces get shown using -iname, either with or without print0 
and/or xargs -0.

Do they show up on your box or are you asuming they will?
  
Mmm interesting. Works fine on mine. I did the following test
touch "a file with spaces.txt"
touch "another file with spaces.txt"
then ran
find . -iname "*.txt"
which resulted in
./a file with spaces.txt
./another file with spaces.txt
and then ran
find . -iname "*.txt" | grep "another" 
which gave me what I would expect
./another file with spaces.txt
Unless I am missing something with the test, I would assume that the
above was sufficient to prove it works. So perhaps we are running
different versions of find?

This is the version I am running ...

[EMAIL PROTECTED] ~/Desktop]$ find --version
GNU find version 4.2.24
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION

Regards

Neill

Reply via email to