Re: [gentoo-user] grep -lr ignoring subdirs that start with dot (.)?

2015-04-23 Thread Neil Bothwick
On Thu, 23 Apr 2015 07:32:54 -0400, Tanstaafl wrote:

> What I'd like is the output you get with
> 
> 'grep -ir "searchstring" .'
> 
> which includes the line of text from each matching file that contains
> the searchstring, like this:
> 
> > ./user/Maildir/cur/1429731479.M511050P25876.hostname,S=3097,W=3185:2,S:Name
> > asked me to approve Test PO 12036 this afternoon so she could
> > see 
> > ./user/Maildir/cur/1429731479.M511050P25876.hostname,S=3097,W=3185:2,S:it
> > in the system.   In looking at Test PO 12033 & 12034 they show
> > signed 
> > ./user/Maildir/cur/1429731479.M511050P25876.hostname,S=3097,W=3185:2,S:by
> > me however I did not approve these test PO's only test PO 12036 -
> > how ./user/Maildir/cur/1429731479.M511050P25876.hostname,S=3097,W=3185:2,S:
> > Name asked me to approve Test PO 12036 this afternoon so she could  
> 
> but...
> 
> What I'd like is for each output line showing the file-hit to be
> prefaced with at least the date/time of the file (permissions/owner etc
> would be ok too, but I at least need the date/time), like you get when
> doing an ls -al...

Something like this?

for i in $(grep -lr searchstring .);do
ls -l $i
grep -H searchstring $i
done

I'm sure you could format it better using the options from ls.


-- 
Neil Bothwick

I am McCoy of Bo...Damnit! I'm a doctor, not a collective!


pgpXKjeFCOMq8.pgp
Description: OpenPGP digital signature


Re: [gentoo-user] grep -lr ignoring subdirs that start with dot (.)?

2015-04-23 Thread Tanstaafl
On 4/17/2015 5:59 PM, Neil Bothwick  wrote:
> Since you want to search the entire contents f the current directory,
> there is no need to pass grep a list of directories (especially not an
> incomplete list), use "grep -lr ."

Ok, thanks Neil, but this is still not what I'm looking for... here's a
snip of what I got:

> ./user1/Maildir/.Sent/cur/1348064019.M219121P18374.mailhost.com,S=7615,W=7788:2,S
> ./user1/Maildir/.Sent/dovecot.index.cache
> ./user2/Maildir/cur/1348063111.Vfe02Ia7fe0eM242648.mailhost.com:2,S
> ./user2/Maildir/dovecot.index.cache

What I'd like is the output you get with

'grep -ir "searchstring" .'

which includes the line of text from each matching file that contains
the searchstring, like this:

> ./user/Maildir/cur/1429731479.M511050P25876.hostname,S=3097,W=3185:2,S:Name 
> asked me to approve Test PO 12036 this afternoon so she could see
> ./user/Maildir/cur/1429731479.M511050P25876.hostname,S=3097,W=3185:2,S:it in 
> the system.   In looking at Test PO 12033 & 12034 they show signed
> ./user/Maildir/cur/1429731479.M511050P25876.hostname,S=3097,W=3185:2,S:by me 
> however I did not approve these test PO's only test PO 12036 - how
> ./user/Maildir/cur/1429731479.M511050P25876.hostname,S=3097,W=3185:2,S:
> Name asked me to approve Test PO 12036 this afternoon so she could

but...

What I'd like is for each output line showing the file-hit to be
prefaced with at least the date/time of the file (permissions/owner etc
would be ok too, but I at least need the date/time), like you get when
doing an ls -al...

Is this just not possible?

Thanks again...



Re: [gentoo-user] grep -lr ignoring subdirs that start with dot (.)?

2015-04-19 Thread Andreas K. Huettel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Am Freitag, 17. April 2015, 22:57:49 schrieb Tanstaafl:
> 
> grep -lr  * | xargs ls -lt
> 
> ^^^ appears to work, and does return results for the cur and new
> subdirs, but seems to be ignoring the rest of the Maildirs. Maybe it has
> something to do with the fact that they start with dots (ie, .Sent,
> .Trash, etc)??
> 


'*' does not match things starting with a dot, your suspicion is correct. 

(make a directory with one file in it, try
   ls -la 
 versus
   ls -la *
:)

There's a simple solution: 

grep -lr  . | xargs ls -lt


- -- 

Andreas K. Huettel
Gentoo Linux developer 
dilfri...@gentoo.org
http://www.akhuettel.de/

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0

iQJ8BAEBCgBmBQJVM42nXxSAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w
ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ0RkJDMzI0NjNBOTIwMDY5MTQ2NkMzNDBF
MTM4NkZEN0VGNEI1Nzc5AAoJEOE4b9fvS1d5S60QALUnG47SWSGLhTvRqjkZOV5N
azVJ2IECtTpfs39abkjIA77lJ0CPFAfBvM6rFMSu2WV4D39jHSRAtCYoq34OgG2s
Vh03CL8igCj6oPqcgmKqnubtpghwetfPf9r+9t5drBiR8oESCiI4J9JZo22aWxkr
f2CMAdXWxDPyGfe/JFT7RBsnNbXn5gNVgIFXzxlIMM3bpiBQXZL6M7IZWrCw9+Sw
a/NpqjcaqzJo13hxeTGGcnUWfVJKOjUAjVs8k8Y+lp68YYSKv30TY90UCziYyFUP
lFjG0ZGY9trz2XPeLzV+Nkds04ISyZVSXGCg6uPLmlQeRxaOEIOVvHUNuJE8ik0A
PsoeChm87uUCgQWV/DuZa2rBUSENNnIM3r8lU/Zh4QTc8fNYmGf80DV+tvvtA4rX
WCwY9wgqaXllDjZce4MM2pBsuQh7crWZU5WvVyMmsFwYYd/8SBv0FI1POU/ze4lr
/3AUDAXQyohY51mwJMbMvOxWNi3gUHjZiIg4LGpV7Uqy4ZMnxb/ezR6wOvJQnKrz
WPpBQXGTG29/oLEhyY/DywA5dspjOoZE+mPG7vuooNM3RucbVH0z+guyDBrei0GL
3fWwbPtTHO7OdgZeM7uO/lCw/W8Wms7r6YWJF+yeZ/DBXkWD+IXAf6toZXV+BJck
f28EWPmh69ldJxyAkfqi
=5+Ts
-END PGP SIGNATURE-



Re: [gentoo-user] grep -lr ignoring subdirs that start with dot (.)?

2015-04-17 Thread covici
Todd Goodman  wrote:

> * Tanstaafl  [150417 16:58]:
> > Hi all,
> > 
> > Ok, this is driving me crazy...
> > 
> > I want to be able to quickly search an entire users Maildir for an email
> > containing a certain string, but output just the filenames WITH THE
> > DATE/TIMEs...
> > 
> > So, from the target users top level Maildir:
> > 
> > grep -lr  * | xargs ls -lt
> > 
> > ^^^ appears to work, and does return results for the cur and new
> > subdirs, but seems to be ignoring the rest of the Maildirs. Maybe it has
> > something to do with the fact that they start with dots (ie, .Sent,
> > .Trash, etc)??
> > 
> > Anyone have any idea why the above doesn't search them all?
> > 
> > Thanks
> 
> Try?
> 
> grep -lr  * | xargs ls -lta
> 
> Maybe?

Better use the find command with -exec grep  and its arguments.  You
will probably need  -H if you want to know the filename.  The difference
is that find only ignores . and .., but does go over other things
beginning with . 

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

 John Covici
 cov...@ccs.covici.com



Re: [gentoo-user] grep -lr ignoring subdirs that start with dot (.)?

2015-04-17 Thread Neil Bothwick
On Fri, 17 Apr 2015 16:57:49 -0400, Tanstaafl wrote:

> So, from the target users top level Maildir:
> 
> grep -lr  * | xargs ls -lt
> 
> ^^^ appears to work, and does return results for the cur and new
> subdirs, but seems to be ignoring the rest of the Maildirs. Maybe it has
> something to do with the fact that they start with dots (ie, .Sent,
> .Trash, etc)??
> 
> Anyone have any idea why the above doesn't search them all?

The shell expands * to the contents of the current directory, excluding
hidden files. It's not grep's doing it is the shell expansion that is
catching you out.

Since you want to search the entire contents f the current directory,
there is no need to pass grep a list of directories (especially not an
incomplete list), use "grep -lr ."


-- 
Neil Bothwick

Bug: (n.) any program feature not yet described to the marketing
department.


pgp7QJbs6sO6q.pgp
Description: OpenPGP digital signature


Re: [gentoo-user] grep -lr ignoring subdirs that start with dot (.)?

2015-04-17 Thread Todd Goodman
* Tanstaafl  [150417 16:58]:
> Hi all,
> 
> Ok, this is driving me crazy...
> 
> I want to be able to quickly search an entire users Maildir for an email
> containing a certain string, but output just the filenames WITH THE
> DATE/TIMEs...
> 
> So, from the target users top level Maildir:
> 
> grep -lr  * | xargs ls -lt
> 
> ^^^ appears to work, and does return results for the cur and new
> subdirs, but seems to be ignoring the rest of the Maildirs. Maybe it has
> something to do with the fact that they start with dots (ie, .Sent,
> .Trash, etc)??
> 
> Anyone have any idea why the above doesn't search them all?
> 
> Thanks

Try?

grep -lr  * | xargs ls -lta

Maybe?

Todd



[gentoo-user] grep -lr ignoring subdirs that start with dot (.)?

2015-04-17 Thread Tanstaafl
Hi all,

Ok, this is driving me crazy...

I want to be able to quickly search an entire users Maildir for an email
containing a certain string, but output just the filenames WITH THE
DATE/TIMEs...

So, from the target users top level Maildir:

grep -lr  * | xargs ls -lt

^^^ appears to work, and does return results for the cur and new
subdirs, but seems to be ignoring the rest of the Maildirs. Maybe it has
something to do with the fact that they start with dots (ie, .Sent,
.Trash, etc)??

Anyone have any idea why the above doesn't search them all?

Thanks