Date: Thu, 8 Sep 2022 07:31:16 +0100 From: Steve O'Hara-Smith <steve@sohara.org> To: questions@freebsd.org Subject: Re: Slightly OT: How to grep for two different things in a file Message-ID: <20220908073116.b95bf1b1495863241cc26248@sohara.org> In-Reply-To: <86edwmmsyu.fsf@bay.localnet> References: <CAGBxaXn6ZO-e0746fwzNp%2Bv-6bAucjxePMOt-mEv2HKmkCBXcg@mail.gmail.com> <86edwmmsyu.fsf@bay.localnet>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 07 Sep 2022 20:43:21 -0700 Carl Johnson <carlj@peak.org> wrote: > I use grep -l to just return a list of files that contain one pattern, > and then grep -l for the second pattern on that list. That can be done > in one line for your example as follows: > > grep -li /tmp `grep -liR tid src/java` This fails in the presence of filenames with spaces, which is a pity because it is very elegant. -- Steve O'Hara-Smith <steve@sohara.org>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220908073116.b95bf1b1495863241cc26248>