Re: Find a file with an unknown name

2010-05-18 Thread Eitan Adler
 I want to find a file that was recently created.

find dir -newerct '1 hour ago' -print

 The content within the file is known, so I can grep for that. The
 directory structure that contains the file is also known. The filename
 is not known.

grep -R content dir
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Find a file with an unknown name

2010-05-18 Thread doug schmidt
On Tue, May 18, 2010 at 5:37 AM, Eitan Adler li...@eitanadler.com wrote:
 I want to find a file that was recently created.

 find dir -newerct '1 hour ago' -print

you can also find all files newer than file.txt.

find dir -newer file.txt -print




 The content within the file is known, so I can grep for that. The
 directory structure that contains the file is also known. The filename
 is not known.

 grep -R content dir
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Find a file with an unknown name

2010-05-18 Thread Frank Shute
On Mon, May 17, 2010 at 10:15:43PM -0400, Steve Bertrand wrote:

 I want to find a file that was recently created.
 
 The content within the file is known, so I can grep for that. The
 directory structure that contains the file is also known. The filename
 is not known.
 
 What command string do I use to search a directory structure for a file,
 when my search pattern only matches content and not filename?
 
 Steve

To find files that I've recently created, I use the -Btime flag of
find.

E.g:

find . -type f -Btime 1

find files created in the last 24 hours.


Regards,

-- 

 Frank

 Contact info: http://www.shute.org.uk/misc/contact.html


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Find a file with an unknown name

2010-05-17 Thread Steve Bertrand
I want to find a file that was recently created.

The content within the file is known, so I can grep for that. The
directory structure that contains the file is also known. The filename
is not known.

What command string do I use to search a directory structure for a file,
when my search pattern only matches content and not filename?

Steve
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Find a file with an unknown name

2010-05-17 Thread Randal L. Schwartz
 Steve == Steve Bertrand st...@ipv6canada.com writes:

Steve What command string do I use to search a directory structure for a file,
Steve when my search pattern only matches content and not filename?

grep -r 'pattern here' top-level-dir-here

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
mer...@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Find a file with an unknown name

2010-05-17 Thread Steve Bertrand
On 2010.05.17 22:17, Randal L. Schwartz wrote:
 Steve == Steve Bertrand st...@ipv6canada.com writes:
 
 Steve What command string do I use to search a directory structure for a 
 file,
 Steve when my search pattern only matches content and not filename?
 
 grep -r 'pattern here' top-level-dir-here

Something I do all the time, but couldn't think of it when I needed it most.

Much respect for your first response on a FBSD list.

Cheers ;)

Steve
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Find a file with an unknown name

2010-05-17 Thread Roy Hubbard

Steve Bertrand wrote:

I want to find a file that was recently created.

The content within the file is known, so I can grep for that. The
directory structure that contains the file is also known. The filename
is not known.

What command string do I use to search a directory structure for a file,
when my search pattern only matches content and not filename?

Steve
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org
  

Maybe this will work.

From the top of the directory structure:

grep -R {expression} .
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org