Date: Mon, 01 Mar 1999 05:58:43 +1000 From: Greg Black <gjb@comkey.com.au> To: cjclark@home.com Cc: sogon@psytrance.com, freebsd-questions@FreeBSD.ORG Subject: Re: problem with cat command Message-ID: <19990228195843.12217.qmail@alpha.comkey.com.au> In-Reply-To: <199902281851.NAA13328@cc942873-a.ewndsr1.nj.home.com> of Sun, 28 Feb 1999 13:51:58 EST References: <199902281851.NAA13328@cc942873-a.ewndsr1.nj.home.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> > 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 <gjb@acm.org> 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?19990228195843.12217.qmail>