delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/12/09/14:31:55

X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Subject: RE: xargs gives grep/gawk too much
Date: Sat, 9 Dec 2006 11:31:05 -0800
Message-ID: <0C260F619E428642BFA6380177C3ADF30472ADCC@exmsea005.us.wamu.net>
In-Reply-To: <31DDB7BE4BF41D4888D41709C476B65704169472@NIHCESMLBX5.nih.gov>
From: "Karr, David" <david DOT karr AT wamu DOT net>
To: <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id kB9JVrYq031729

If the point of this note is to get your pipeline to work, would it help
if you added something like "-n 30" to the xargs command?  This should
execute one instance of 'grep -l -e "error '1234567890'"' for every 30
lines of output from the previous pipe entry.

	$ echo path/* | \
		tr ' ' '\n' | \
		grep -v -e '\*' | \
		xargs -r grep -l -e "error '1234567890'" | \
		rest_of_pipe 

> -----Original Message-----
> From: cygwin-owner AT cygwin DOT com 
> [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of Buchbinder, 
> Barry (NIH/NIAID) [E]
> Sent: Friday, December 08, 2006 10:05 AM
> To: cygwin AT cygwin DOT com
> Subject: xargs gives grep/gawk too much
> 
> I get the following error message:
> 	xargs: grep: Argument list too long
> I've also gotten an equivalent error from xargs/gawk.
> 
> Of course, the whole idea of xargs is to avoid this error.  
> If I'm doing something wrong, I'd appreciate some hints of 
> what I am doing wrong or how to avoid this (other than "-s"). 
>  Otherwise, I suppose that this is a bug report.
> 
> The grep pipe, run under bash, that generates the error message is as
> follows:
> 
> 	$ echo path/* | \
> 		tr ' ' '\n' | \
> 		grep -v -e '\*' | \
> 		xargs -r grep -l -e "error '1234567890'" | \
> 		rest_of_pipe
> 
> Asking xargs to report on its limits:
> 
> 	$ echo path/* | \
> 		tr ' ' '\n' | \
> 		xargs --show-limits grep -e I_do_not_want_output
> 	Your environment variables take up 2174 bytes
> 	POSIX lower and upper limits on argument length: 2048, 1046528
> 	Maximum length of command we could actually use: 1044354
> 	Size of command buffer we are actually using: 34942
> 
> Everything should be up to date.  cygcheck.out is attached.  
> Let me know if you want any other information.
> 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019