Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 May 2009 18:32:39 +0200
From:      Polytropon <freebsd@edvax.de>
To:        "Zbigniew Szalbot" <z.szalbot@lcwords.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: find and searching for specific expression in files
Message-ID:  <20090530183239.a6755d97.freebsd@edvax.de>
In-Reply-To: <dd6b168d2af9ddbcfc52e5c0397e4d6a.squirrel@relay.lc-words.com>
References:  <dd6b168d2af9ddbcfc52e5c0397e4d6a.squirrel@relay.lc-words.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 30 May 2009 11:25:12 +0200, "Zbigniew Szalbot" <z.szalbot@lcwords.com> wrote:
> Hello,
> 
> Can you please give me a hint how to use find to search for a specific
> text within files?

One valid solution is to combine find (to find the files) and
grep (to search in them). For the combination, you can use
the famous back-tics.

	% grep "expression" `find /path/to/files/ -mtime -2 -print`

Of course, there are surely easier, faster and better means,
but from this one, I know it just works. :-) Furthermore, I
think -print is optional here.

If you want to use the Midnight Commander, use Meta-? for a
combined dialog:

	+----------------- Find File ------------------+
	|                                              |
	| Start at: _______________________________[^] |
	|                                              |
	| Filename: _______________________________[^] |
	|                                              |
	| Content:  _______________________________[^] |
	|                                              |
	| [ ] case Sensitive                           |
	|                                              |
	| [< OK >]  [ Tree ]                [ Cancel ] |
	+----------------------------------------------+

That's what I mostly use.




-- 
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090530183239.a6755d97.freebsd>