From owner-freebsd-questions Sun Feb 28 12: 0:42 1999 Delivered-To: freebsd-questions@freebsd.org Received: from alpha.comkey.com.au (alpha.comkey.com.au [203.9.152.215]) by hub.freebsd.org (Postfix) with SMTP id 1F6D7152B8 for ; Sun, 28 Feb 1999 12:00:36 -0800 (PST) (envelope-from gjb@comkey.com.au) Received: (qmail 12218 invoked by uid 1001); 28 Feb 1999 19:58:43 -0000 Message-ID: <19990228195843.12217.qmail@alpha.comkey.com.au> X-Posted-By: GBA-Post 1.04 06-Feb-1999 X-PGP-Fingerprint: 5A91 6942 8CEA 9DAB B95B C249 1CE1 493B 2B5A CE30 Date: Mon, 01 Mar 1999 05:58:43 +1000 From: Greg Black To: cjclark@home.com Cc: sogon@psytrance.com, freebsd-questions@FreeBSD.ORG Subject: Re: problem with cat command References: <199902281851.NAA13328@cc942873-a.ewndsr1.nj.home.com> In-reply-to: <199902281851.NAA13328@cc942873-a.ewndsr1.nj.home.com> of Sun, 28 Feb 1999 13:51:58 EST Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > does anyone know what the limit of args to the cat command is, > > The command itself appears to have no limit (from a quick peak at > '/usr/src/bin/cat/cat.c'). The limit you'll probably hit is the number > of arguments the shell is willing to take. The critical limit is determined by the kernel. Read the man pages for sysctl(3) and execve(2) for details. On my system, I get: $ sysctl kern.argmax kern.argmax: 65536 You cannot change this value on a running system. > > basically what i want to do is cat 15000 files into another file how would i > > do this > > Break it up into chunks. How to do this depends on your shell of > choice and the way the files are named. This problem is easily solved by the standard utility xargs(1). If the original command line was cat * > newfile then replace it with ls | xargs cat >> newfile Note that you can't specify all the files to xargs in the same way that already failed when you tried to invoke cat, for the same reasons. You have to get a program to generate the names as output and then feed that to xargs. Another program to do this if ls(1) doesn't work for you is find(1). For instance, say you had 50,000 files in some tree and you wanted all the ones with an 'e' in their names to be removed, you could do find . -type f -name '*e*' | xargs rm -- Greg Black To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message