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!

Attachment: pgpXKjeFCOMq8.pgp
Description: OpenPGP digital signature

Reply via email to