Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com> List-Archive: <http://sources.redhat.com/ml/cygwin/> List-Post: <mailto:cygwin AT cygwin DOT com> List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <0dde01c21d05$d11a7810$6132bc3e@BABEL> From: "Conrad Scott" <Conrad DOT Scott AT dsl DOT pipex DOT com> To: "Thomas Baker" <thomas DOT baker AT bi DOT fhg DOT de> Cc: <cygwin AT cygwin DOT com> References: <20020626125840 DOT A576 AT mail DOT gmd DOT de> Subject: Re: grep - limited number of arguments? Date: Wed, 26 Jun 2002 12:37:10 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 "Thomas Baker" <thomas DOT baker AT bi DOT fhg DOT de> wrote: > One difficulty I have found, however, is limitations (or so > it would seem) on the number of arguments that the command > "grep" can take. You can't (portably) rely on anything much more than a few thousand characters in a single command line. The minimum requirement for a Posix system is 4096 (see <limits.h>). The usual technique is to use `xargs', as: ls | xargs grep pattern (or even `ls | xargs grep pattern /dev/null' to catch the case with only one argument being given to grep and it changing behaviour). This splits up the incoming arguments and invokes grep repeatedly, a batch of the arguments at a time. It's particularly useful with `find' and it's got lots of lovely options to play with too :-) It would be nice to allow arbitrary command lines, but I've never (knowingly) used a system that did so. // Conrad -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/