Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!rochester!pt.cs.cmu.edu!cadre!pitt!amanue!jr From: jr@amanue.UUCP (Jim Rosenberg) Newsgroups: comp.sys.att Subject: Re: Runaway newsfiles break ls Summary: read up on xargs Message-ID: <448@amanue.UUCP> Date: 4 Mar 89 06:38:35 GMT References: <629@mccc.UUCP> Reply-To: jr@amanue.UUCP (Jim Rosenberg) Distribution: usa Organization: Amanuensis Inc., Grindstone, PA Lines: 33 In article <629@mccc.UUCP> pjh@mccc.UUCP (Pete Holsberg) writes: >I have so many .ara????, .arb????, .ina????? and .inb??? in >/usr2/spool/news that any command that uses metacharacters returns with >the "too many arguments" message, and ls runs out of memory and dumps core! > >How can I either process these or get rid of them? In a word, xargs. xargs is indispensable in getting around the 1001 ways the limits on the size of an arg list can bite you. Something like this: cd /usr2/spool/news ls | grep '^[.]ara' | xargs rm -f Oops you said even ls gags. Well in that case you can try cd /usr2/spool/news find . -print | grep '^[.]/[.]ara' | xargs rm -f This is a real peeg to walk the whole tree just to get the current directory -- you could always bang out a quick C program to read . using Gwyn's dirent library if you don't have one. (BTW \. would work fine in place of [.] in the regular expressions, but I make it a habit to escape metacharacters in regular expressions with brackets because that works with parentheses too. \( is not the same thing as [(]!!!) The nifty thing about UNIX is that there are always so many ways to do something when one doesn't work you can try another. -- Jim Rosenberg CIS: 71515,124 decvax!idis! \ WELL: jer allegra! ---- pitt!amanue!jr BIX: jrosenberg uunet!cmcl2!cadre! /