From owner-freebsd-questions@FreeBSD.ORG Mon Apr 7 07:04:08 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 75D9B37B407 for ; Mon, 7 Apr 2003 07:04:07 -0700 (PDT) Received: from smtp.infracaninophile.co.uk (smtp.infracaninophile.co.uk [81.2.69.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7ADFF43F93 for ; Mon, 7 Apr 2003 07:04:05 -0700 (PDT) (envelope-from m.seaman@infracaninophile.co.uk) Received: from happy-idiot-talk.infracaninophile.co.uk (localhost [127.0.0.1]) h37E41ra051982 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 7 Apr 2003 15:04:01 +0100 (BST) (envelope-from matthew@happy-idiot-talk.infracaninophile.co.uk) Received: (from matthew@localhost)h37E41js051981 for freebsd-questions@freebsd.org; Mon, 7 Apr 2003 15:04:01 +0100 (BST) Date: Mon, 7 Apr 2003 15:04:01 +0100 From: Matthew Seaman To: freebsd-questions@freebsd.org Message-ID: <20030407140401.GB51281@happy-idiot-talk.infracaninophi> Mail-Followup-To: Matthew Seaman , freebsd-questions@freebsd.org References: <200304071324.52494.a.carter@intrasoft.lu> <20030407140430.W10888-100000@gwdu60.gwdg.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="V0207lvV8h4k8FAm" Content-Disposition: inline In-Reply-To: <20030407140430.W10888-100000@gwdu60.gwdg.de> User-Agent: Mutt/1.5.4i X-Spam-Status: No, hits=-38.8 required=5.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,PGP_SIGNATURE_2, QUOTED_EMAIL_TEXT,REFERENCES,REPLY_WITH_QUOTES, USER_AGENT_MUTT version=2.50 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Subject: Re: searching insed(ide) files X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Apr 2003 14:04:08 -0000 --V0207lvV8h4k8FAm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 07, 2003 at 02:06:26PM +0200, Konrad Heuer wrote: >=20 > On Mon, 7 Apr 2003, CARTER Anthony wrote: >=20 > > I am looking for a way to search inside a number of text files for a > > particular string and return the name of the file if found. Any ideas? >=20 > grep -c string file file ... | grep '1$' | sed 's/:.*$//' grep -l string filename...=20 does exactly what Anthony wants much more simply. Cheers, Matthew --=20 Dr Matthew J Seaman MA, D.Phil. 26 The Paddocks Savill Way PGP: http://www.infracaninophile.co.uk/pgpkey Marlow Tel: +44 1628 476614 Bucks., SL7 1TH UK --V0207lvV8h4k8FAm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+kYVRdtESqEQa7a0RAqG4AJ96oU5jX2Tfr4DT7qV/jpNdLh7swwCdF+3k EuDaQYgq1SKT7g5q14pXbnc= =Skim -----END PGP SIGNATURE----- --V0207lvV8h4k8FAm--