From owner-freebsd-questions Tue Dec 24 15:13:24 2002 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 09E5C37B401 for ; Tue, 24 Dec 2002 15:13:23 -0800 (PST) Received: from sccrmhc01.attbi.com (sccrmhc01.attbi.com [204.127.202.61]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C83B43EB2 for ; Tue, 24 Dec 2002 15:13:22 -0800 (PST) (envelope-from kkb@breathhost.net) Received: from [192.168.1.63] (12-240-247-89.client.attbi.com[12.240.247.89]) by sccrmhc01.attbi.com (sccrmhc01) with SMTP id <20021224231317001003kilce>; Tue, 24 Dec 2002 23:13:17 +0000 User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.3 Date: Tue, 24 Dec 2002 15:13:18 -0800 Subject: Re: Argument list too long: limitation in grep? bash? FreeBSD? From: Kurt Bigler To: Message-ID: In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG on 12/24/02 2:52 PM, Bill Moran wrote: >> From: paul beard >> >> Bill Moran wrote: >>> d/l the entire php documentation as individual html files. >>> This equates to a LOT of files in a single directory (how can >>> I get a count of this?) >>> Anyway, I'm trying to find the docs on some features that >>> the www.php.net's search isn't really helping on (searching >>> for __FILE__ doesn't search for __FILE__ ... it searches for >>> file, and there's too many results) so I try: >>> grep __FILE__ *.html >>> and I get the error: >>> -bash: /usr/bin/grep: Argument list too long >>> Is this a shortcoming of bash, grep or FreeBSD? I'm assuming >>> it's not grep, as the command: >>> find . -name *.html -print | xargs grep __FILE__ >>> yeilds: >>> -bash: /usr/bin/find: Argument list too long >> >> try grep "__FILE__" *.html. > > Makes no difference, I get the same error. > >> to get a file coun, 'ls | wc' might work. > > That helped! I've got >3000 files in that > directory. The success of the second item maybe gives a clue how to approach the first. Maybe try something like this: ls | grep .html > temp edit temp to insert "grep " at the beginning of each line e.g. in vi use :%s/^/grep __FILE__ / Now temp contains bunch of lines like: grep __FILE__ file1.html grep __FILE__ file2.html grep __FILE__ file3.html Then chmod +x temp and execute it or use temp as input to your desired shell. HTH, Kurt Bigler To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message