Gentoo Archives: gentoo-user

From: Neil Bothwick <neil@××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] grep -lr ignoring subdirs that start with dot (.)?
Date: Fri, 17 Apr 2015 21:59:44
Message-Id: 20150417225927.25380c30@digimed.co.uk
In Reply to: [gentoo-user] grep -lr ignoring subdirs that start with dot (.)? by Tanstaafl
1 On Fri, 17 Apr 2015 16:57:49 -0400, Tanstaafl wrote:
2
3 > So, from the target users top level Maildir:
4 >
5 > grep -lr <searchstring> * | xargs ls -lt
6 >
7 > ^^^ appears to work, and does return results for the cur and new
8 > subdirs, but seems to be ignoring the rest of the Maildirs. Maybe it has
9 > something to do with the fact that they start with dots (ie, .Sent,
10 > .Trash, etc)??
11 >
12 > Anyone have any idea why the above doesn't search them all?
13
14 The shell expands * to the contents of the current directory, excluding
15 hidden files. It's not grep's doing it is the shell expansion that is
16 catching you out.
17
18 Since you want to search the entire contents f the current directory,
19 there is no need to pass grep a list of directories (especially not an
20 incomplete list), use "grep -lr ."
21
22
23 --
24 Neil Bothwick
25
26 Bug: (n.) any program feature not yet described to the marketing
27 department.

Replies

Subject Author
Re: [gentoo-user] grep -lr ignoring subdirs that start with dot (.)? Tanstaafl <tanstaafl@×××××××××××.org>