Runaway newsfiles break ls

Jim Rosenberg jr at amanue.UUCP
Sat Mar 4 16:38:35 AEST 1989


In article <629 at mccc.UUCP> pjh at 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! /



More information about the Comp.sys.att mailing list