procmail
[Top] [All Lists]

Re: ls Error

2000-05-18 07:32:06
2000-05-15-06:48:59 SoloCDM:
Recently I executed the following command:

     rm -f dummy "ls -t msg.* | sed -e 1,900d"

As a result, I received the following error:

     bash: /bin/ls: Argument list too long

I know why (14,522 msg.* files exist in the directory), but I need a
solution.

There are many possible solutions. How about

        ls -t|grep '^msg\.'|sed -e 1,900d|xargs rm -f

although I'd tend to pronounce that

        ls -t|grep '^msg\.'|perl -lne 'unlike if $. > 900'

myself, but that's just me. Then there's

        perl -e '@f=grep{/^msg\./}<*>;splice @f,0,900;unlink @f'

-Bennett

Attachment: pgpfYkmdlyp6O.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>