Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com From: "Simon Willcox" To: Subject: FW: 'find | xargs -n100 -i{} echo "{}"': works, but is slower than without "-i{}" Date: Fri, 22 Jun 2001 10:50:57 +0100 Message-ID: <000001c0fb00$d72e4740$0200a8c0@BLUESIMON> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2627 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal Try find . -type f -print0 | xargs -0 grep etc Simon -----Original Message----- From: cygwin-owner AT sources DOT redhat DOT com [mailto:cygwin-owner AT sources DOT redhat DOT com] On Behalf Of Karr, David Sent: 21 June 2001 19:37 To: 'cygwin AT cygwin DOT com' Subject: 'find | xargs -n100 -i{} echo "{}"': works, but is slower than without "-i{}" I work on a project where some of the files and directories were created with spaces in them. That will eventually be rectified, but it's hard to say when (we use a CM system that doesn't make this easy to deal with). I often find that I have to do "find | grep" operations. I realized I couldn't get this to work unless I did something like this: find . -type f | xargs -n100 -i{} grepf searchstring "{}" I use "-n100" to try to make it somewhat more efficient than starting a process for each line, although I still need to pay attention to command-line length limits. The combination of '-i{}' and '"{}"' makes it so that directories with spaces in them will be handled correctly. Without that, "grep" tries to search in the wrong directories (or nonexistent directories, most likely). This works. However, I accidently discovered that using "-i{}" essentially causes my "-n100" option to be ignored. When I changed my "command" to just prepend "echo" to the command line, I found it was executing one command for each file, as opposed to one command for each 100 files. This considerably slows down my tree searches. Is there any way to get back my more efficient command line, while still working with my annoying "spacy" directories? I was actually able to repeat this on both Cygwin and a Linux system, so perhaps this is "defined" behavior. -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple