[olug] Unix Tip: DEALING WITH TOO MANY FILES
Brian Roberson
roberson at olug.org
Fri Mar 21 21:55:46 UTC 2003
while it does not directly answer your question - shell expansion is always
an option
example:
#################
cd /some/dir
rm *
if [ $? != "0" ] ; then
rm [a-g]*
rm [h-z]*
rm [0-5]*
rm [6-9]*
fi
#################
not very elaborate... but you get the idea.
----- Original Message -----
From: "Quinn Coldiron" <qcoldir at nmhs.org>
To: "Omaha Linux User Group" <olug at olug.org>
Sent: Friday, March 21, 2003 1:56 PM
Subject: Re: [olug] Unix Tip: DEALING WITH TOO MANY FILES
> One of the many problems I have with a certain package I support on AIX
> is that they dump and ton and a half of files into a single directory,
> and I can't change that. I need to clean that out periodically and rm *
> gives me the same error. Recursively removing the directory and then
> rebuilding the directory is not an option, so I made a shell script to
> do this:
>
> #!/bin/sh
> for i in `ls -1`
> do
> rm $i
> done
>
> Does somebody know of a better way?
>
> Quinn
>
>
>
> On Fri, 2003-03-21 at 13:24, Unix Guru Universe wrote:
> > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> >
> > UNIX GURU UNIVERSE
> > UNIX HOT TIP
> >
> > Unix Tip 1906 - March 21, 2003
> >
> > http://www.ugu.com/sui/ugu/show?tip.today
> >
> > =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> >
> >
> > DEALING WITH TOO MANY FILES
> >
> > In case there are too many files in a
> > particular directory and you try doing
> >
> > $ grep "ABC" *
> >
> > And it fails saying
> > ksh: /usr/bin/find: 0403-027 The parameter list is too long.
> >
> > what would you do?
> >
> > Well you can do the following:
> >
> > $ls |xargs grep "ABC"
> >
> > This tip generously supported by: puneeta at delhi.tcs.co.in
> >
> >
>
> --------------------------------------------------------------------------
> > To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe
> > To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe
> > To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today
> >
> >
==========================================================================
> > DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND
ARE
> > NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
> > GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
> > ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.
> >
> > Unix Guru Universe - www.ugu.com - tips at ugu.com - Copyright 1994-2001
> >
==========================================================================
> >
> > _______________________________________________
> > OLUG mailing list
> > OLUG at olug.org
> > http://lists.olug.org/mailman/listinfo/olug
> --
>
> -----------------------------
> Quinn P. Coldiron
> Cerner Technical Coordinator
> Nebraska Methodist Hospital
> 402-354-1619
> qcoldir at nmhs.org
>
>
> _______________________________________________
> OLUG mailing list
> OLUG at olug.org
> http://lists.olug.org/mailman/listinfo/olug
>
More information about the OLUG
mailing list