Date: Tue, 24 Dec 2002 15:13:18 -0800 From: Kurt Bigler <kkb@breathhost.net> To: <questions@FreeBSD.ORG> Subject: Re: Argument list too long: limitation in grep? bash? FreeBSD? Message-ID: <BA2E2A0E.594F%kkb@breathhost.net> In-Reply-To: <F116hOBPqvTEbnm0hrD0000fe7f@hotmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
on 12/24/02 2:52 PM, Bill Moran <bill_moran2@hotmail.com> wrote:
>> From: paul beard <paulbeard@mac.com>
>>
>> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BA2E2A0E.594F%kkb>
