Re: [gentoo-user] Search filesystem with a wildcard

2011-03-01 Thread Grant
 I'm having trouble with this again.  I get:

 # ls -l /var/cache/revdep-rebuild
 total 424
 -rwx-- 1 root portage    699 Feb 28 16:52 0_env.rr
 -rwx-- 1 root portage 323445 Feb 28 16:38 1_files.rr
 -rwx-- 1 root portage  34387 Feb 28 16:38 2_ldpath.rr
 -rwx-- 1 root portage     57 Feb 28 16:40 3_broken.rr
 -rwx-- 1 root portage  34641 Feb 28 16:39 3_errors.rr
 -rwx-- 1 root portage     19 Feb 28 16:40 4_ebuilds.rr
 -rwx-- 1 root portage     79 Feb 28 16:40 4_owners.rr
 -rwx-- 1 root portage     23 Feb 28 16:40 4_pkgs.rr
 -rwx-- 1 root portage     23 Feb 28 16:40 4_raw.rr
 -rwx-- 1 root portage     25 Feb 28 16:40 5_order.rr
 -rwx-- 1 root portage      2 Feb 28 16:52 6_status.rr
 # locate *.rr
 #

 Check the the PRUNEPATHS setting in /etc/updatedb.conf. I have
 /var/cache in it, but I'm not sure if this was the default, or it I did
 change this myself. The other explanation would be that there is a file
 matching *.rr in the current directory.

        Wonko

You're right, it's in there by default.  Thank you.

- Grant



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-28 Thread Grant
 I used to use slocate like this to search the filesystem for a file:

 foo*.txt

 but mlocate doesn't seem to accept wildcards.  I tried to figure out
 how to do it with find but failed.  Can anyone point me in the right
 direction?

 - Grant



 Try locate */foo*.txt. mlocate seems to match based on the full path name.

 Also, to quote the manpage:

 If any PATTERN contains no globbing characters, locate behaves as if
 the pattern were *PATTERN*.

 I get it now, thank you for that.

 - Grant

I'm having trouble with this again.  I get:

# ls -l /var/cache/revdep-rebuild
total 424
-rwx-- 1 root portage699 Feb 28 16:52 0_env.rr
-rwx-- 1 root portage 323445 Feb 28 16:38 1_files.rr
-rwx-- 1 root portage  34387 Feb 28 16:38 2_ldpath.rr
-rwx-- 1 root portage 57 Feb 28 16:40 3_broken.rr
-rwx-- 1 root portage  34641 Feb 28 16:39 3_errors.rr
-rwx-- 1 root portage 19 Feb 28 16:40 4_ebuilds.rr
-rwx-- 1 root portage 79 Feb 28 16:40 4_owners.rr
-rwx-- 1 root portage 23 Feb 28 16:40 4_pkgs.rr
-rwx-- 1 root portage 23 Feb 28 16:40 4_raw.rr
-rwx-- 1 root portage 25 Feb 28 16:40 5_order.rr
-rwx-- 1 root portage  2 Feb 28 16:52 6_status.rr
# locate *.rr
#

- Grant



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-28 Thread Alex Schuster
Grant writes:

 I'm having trouble with this again.  I get:
 
 # ls -l /var/cache/revdep-rebuild
 total 424
 -rwx-- 1 root portage699 Feb 28 16:52 0_env.rr
 -rwx-- 1 root portage 323445 Feb 28 16:38 1_files.rr
 -rwx-- 1 root portage  34387 Feb 28 16:38 2_ldpath.rr
 -rwx-- 1 root portage 57 Feb 28 16:40 3_broken.rr
 -rwx-- 1 root portage  34641 Feb 28 16:39 3_errors.rr
 -rwx-- 1 root portage 19 Feb 28 16:40 4_ebuilds.rr
 -rwx-- 1 root portage 79 Feb 28 16:40 4_owners.rr
 -rwx-- 1 root portage 23 Feb 28 16:40 4_pkgs.rr
 -rwx-- 1 root portage 23 Feb 28 16:40 4_raw.rr
 -rwx-- 1 root portage 25 Feb 28 16:40 5_order.rr
 -rwx-- 1 root portage  2 Feb 28 16:52 6_status.rr
 # locate *.rr
 #

Check the the PRUNEPATHS setting in /etc/updatedb.conf. I have
/var/cache in it, but I'm not sure if this was the default, or it I did
change this myself. The other explanation would be that there is a file
matching *.rr in the current directory.

Wonko



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-27 Thread Willie Wong
On Sun, Feb 27, 2011 at 06:52:36AM +, Stroller wrote:
 AIUI using `find /my/folder -name foo*.txt` (i.e. unquoted) the shell will 
 pass the * to find if it can't expand it itself.

Not necessarily true. 

On bash if you set the 'nullglob' option, if the shell can't find the
file the word will be removed. If you set the 'failglob' character,
the command will quit with an error if the shell can't complete the
path expansion. 

I expect there to be similar options in other shells. 

W
-- 
Willie W. Wong ww...@math.princeton.edu
Data aequatione quotcunque fluentes quantitae involvente fluxiones invenire 
 et vice versa   ~~~  I. Newton



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-27 Thread Grant
 I can't get find to work.  This works:

 locate *foo*.txt

 but none of these work:

 find /my/folder -name foo*.txt
 find /my/folder -name *foo*.txt
 find /my/folder -type f -name '*foo*.txt'

 $ mkdir -p  /my/folder
 mkdir: cannot create directory `/my': Permission denied
 $ mkdir -p my/folder
 $ touch my/folder/foo.txt
 $ find my/folder -type f -name '*foo*.txt'
 my/folder/foo.txt
 $ find /my/folder -name foo*.txt
 find: `/my/folder': No such file or directory
 $ ^/^
 find my/folder -name foo*.txt
 my/folder/foo.txt
 $

 What am I doing wrong?  I do need the find to be recursive in that folder.

 IMO the first thing you're doing wrong is concealing from us what you're 
 actually doing.

 You're telling us that `find /my/folder -name foo*.txt` and two other 
 versions don't work, yet you're relying on us taking your word on it that 
 they don't.

 Prove it!

 You could have done exactly as I did above and create a folder called 
 my/folder and created a file called foo.txt and then copied and pasted from 
 the terminal to show us your actual commands.

 So we are only left to guess that the file you're looking for is NOT actually 
 called foo.txt and it's NOT actually in a folder called /my/folder. So 
 the problem could be that you're looking for a file with a capital letter in 
 its name, and that you're  using -name instead of -iname, or it could be 
 that you're searching the wrong directory tree, or it could be a bunch of 
 other things. Permissions springs to mind.


Yes, if I had posted the real stuff you would have been able to tell
me to use -wholename instead of -name to mimic mlocate functionality.

 But you'd rather waste our time in trying to conceal what you're looking for 
 (I can only assume the file is called Busty big sluts 3.avi) than help us 
 help you.


I don't lose track of my Busty big sluts 3 AVI thank you very much.

- Grant

 Stroller.



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-26 Thread Roman Zilka
Amankwah (Sat, 26 Feb 2011 11:19:22 +0800):
 On Fri, Feb 25, 2011 at 06:26:51PM -0800, Grant wrote:
  I used to use slocate like this to search the filesystem for a file:
  
  foo*.txt
  
  but mlocate doesn't seem to accept wildcards.  I tried to figure out
  how to do it with find but failed.  Can anyone point me in the right
  direction?
  
  - Grant
 
 How about this?
 
 find -name foo*.txt ?

+1 to this solution. Only, it may destroy the universe on some rare
occasions. A safer way:

find / -type f -name 'foo*.txt'

-rz



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-26 Thread Grant
 I used to use slocate like this to search the filesystem for a file:

 foo*.txt

 but mlocate doesn't seem to accept wildcards.  I tried to figure out
 how to do it with find but failed.  Can anyone point me in the right
 direction?

 - Grant



 Try locate */foo*.txt. mlocate seems to match based on the full path name.

 Also, to quote the manpage:

 If any PATTERN contains no globbing characters, locate behaves as if
 the pattern were *PATTERN*.

I get it now, thank you for that.

- Grant



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-26 Thread Grant
 I used to use slocate like this to search the filesystem for a file:

 foo*.txt

 but mlocate doesn't seem to accept wildcards.  I tried to figure out
 how to do it with find but failed.  Can anyone point me in the right
 direction?

 - Grant

 How about this?

 find -name foo*.txt ?

I can't get find to work.  This works:

locate *foo*.txt

but none of these work:

find /my/folder -name foo*.txt
find /my/folder -name *foo*.txt
find /my/folder -type f -name '*foo*.txt'

What am I doing wrong?  I do need the find to be recursive in that folder.

- Grant



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-26 Thread luis jure
on 2011-02-26 at 09:33 Grant wrote:

I can't get find to work.  This works:

locate *foo*.txt

but none of these work:

find /my/folder -name foo*.txt
find /my/folder -name *foo*.txt
find /my/folder -type f -name '*foo*.txt'

What am I doing wrong?  I do need the find to be recursive in that folder.


i'm sorry i haven't been following the thread too closely, but the last
one should work. according to man find, when using wildcards in a search,
you should enclose the pattern in quotes or escape the wildcard, meaning
that all these work:

find /my/folder -type f -name *foo*.txt
find /my/folder -type f -name '*foo*.txt'
find /my/folder -type f -name \*foo\*.txt

they certainly work for me. am i missing something?



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-26 Thread Roman Zilka
  I used to use slocate like this to search the filesystem for a file:
 
  foo*.txt
 
  but mlocate doesn't seem to accept wildcards.  I tried to figure out
  how to do it with find but failed.  Can anyone point me in the right
  direction?
 
  - Grant
 
  How about this?
 
  find -name foo*.txt ?
 
 I can't get find to work.  This works:
 
 locate *foo*.txt
 
 but none of these work:
 
 find /my/folder -name foo*.txt
 find /my/folder -name *foo*.txt
 find /my/folder -type f -name '*foo*.txt'
 
 What am I doing wrong?  I do need the find to be recursive in that folder.


Don't you have some unfortunate alias set up for 'find'? I understand
you already have a working solution, but something's fishy here indeed.
The third one should absolutely work.

By the way, you should probably use quotes with 'locate' too. It might
cause the same kind of unexpected fail in case there happens to be
something which satisfies *foo*.txt in the working directory of the
command.

-rz



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-26 Thread Stroller

On 26/2/2011, at 5:33pm, Grant wrote:
 I can't get find to work.  This works:
 
 locate *foo*.txt
 
 but none of these work:
 
 find /my/folder -name foo*.txt
 find /my/folder -name *foo*.txt
 find /my/folder -type f -name '*foo*.txt'

$ mkdir -p  /my/folder
mkdir: cannot create directory `/my': Permission denied
$ mkdir -p my/folder
$ touch my/folder/foo.txt
$ find my/folder -type f -name '*foo*.txt'
my/folder/foo.txt
$ find /my/folder -name foo*.txt
find: `/my/folder': No such file or directory
$ ^/^
find my/folder -name foo*.txt
my/folder/foo.txt
$ 

 What am I doing wrong?  I do need the find to be recursive in that folder.

IMO the first thing you're doing wrong is concealing from us what you're 
actually doing.

You're telling us that `find /my/folder -name foo*.txt` and two other versions 
don't work, yet you're relying on us taking your word on it that they don't.

Prove it!

You could have done exactly as I did above and create a folder called 
my/folder and created a file called foo.txt and then copied and pasted from 
the terminal to show us your actual commands.

So we are only left to guess that the file you're looking for is NOT actually 
called foo.txt and it's NOT actually in a folder called /my/folder. So the 
problem could be that you're looking for a file with a capital letter in its 
name, and that you're  using -name instead of -iname, or it could be that 
you're searching the wrong directory tree, or it could be a bunch of other 
things. Permissions springs to mind.

But you'd rather waste our time in trying to conceal what you're looking for (I 
can only assume the file is called Busty big sluts 3.avi) than help us help 
you.

Stroller.





Re: [gentoo-user] Search filesystem with a wildcard

2011-02-26 Thread Stroller

On 27/2/2011, at 6:30am, Alan McKinnon wrote:
 On Sunday 27 February 2011 03:46:48 Stroller wrote:
 On 26/2/2011, at 5:33pm, Grant wrote:
 
 find /my/folder -type f -name '*foo*.txt'
 
 
 He didn't quote the search string and neither did the grandparent. Find will 
 do what he's asking and it's most unlikely that's what he wants.
 
 Grant, you have
 
 find /my/folder -name foo*.txt
 
 but you want
 
 find /my/folder -name 'foo*.txt'

AIUI using `find /my/folder -name foo*.txt` (i.e. unquoted) the shell will pass 
the * to find if it can't expand it itself.

So as long as he doesn't have a foo*.txt in his current working directory then 
either command should work fine.

$ ls my/folder/
foo.txt
$ ls foo.txt 
foo.txt
$ rm foo.txt 
$ find my/folder -name foo*.txt
my/folder/foo.txt
$ ls fo*.txt
ls: cannot access fo*.txt: No such file or directory 
$ find my/folder -name fo*.txt
my/folder/foo.txt 
$ find my/folder -name *fo*.txt
my/folder/foo.txt
$ find my/folder -name '*fo*.txt'
my/folder/foo.txt
$ 

I maintain that if OP wanted useful advice he should have demonstrated stuff 
like the outputs of his find commands and of `ls foo*.txt` and `ls 
/my/folder/foo*.txt`. I am getting tired of giving this advice here.

Stroller.




[gentoo-user] Search filesystem with a wildcard

2011-02-25 Thread Grant
I used to use slocate like this to search the filesystem for a file:

foo*.txt

but mlocate doesn't seem to accept wildcards.  I tried to figure out
how to do it with find but failed.  Can anyone point me in the right
direction?

- Grant



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-25 Thread Amankwah
On Fri, Feb 25, 2011 at 06:26:51PM -0800, Grant wrote:
 I used to use slocate like this to search the filesystem for a file:
 
 foo*.txt
 
 but mlocate doesn't seem to accept wildcards.  I tried to figure out
 how to do it with find but failed.  Can anyone point me in the right
 direction?
 
 - Grant

How about this?

find -name foo*.txt ?




Re: [gentoo-user] Search filesystem with a wildcard

2011-02-25 Thread Mike Gilbert
On Fri, Feb 25, 2011 at 9:26 PM, Grant emailgr...@gmail.com wrote:
 I used to use slocate like this to search the filesystem for a file:

 foo*.txt

 but mlocate doesn't seem to accept wildcards.  I tried to figure out
 how to do it with find but failed.  Can anyone point me in the right
 direction?

 - Grant



Try locate */foo*.txt. mlocate seems to match based on the full path name.

Also, to quote the manpage:

If any PATTERN contains no globbing characters, locate behaves as if
the pattern were *PATTERN*.



Re: [gentoo-user] Search filesystem with a wildcard

2011-02-25 Thread Mike Gilbert
On Fri, Feb 25, 2011 at 10:19 PM, Amankwah amankw...@gmail.com wrote:
 How about this?

 find -name foo*.txt ?

Why would you scan the entire file system when you have an speedy index?