bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing the partition number of file arguments to xargs?


From: James Youngman
Subject: Re: Accessing the partition number of file arguments to xargs?
Date: Sun, 21 Dec 2008 23:10:48 +0000

On Sun, Dec 21, 2008 at 10:52 PM, Sven Hartrumpf
<address@hidden> wrote:
> Hi all.
>
> Is there a way to access the partition number of xargs' arguments on
> the command line?
>
> Example:
> xargs -a argfile -n 10 -P 4 processor-program %I ...
>
> %I should be iterating from 1 (or 0) to (number-of-files-in-argfile +
> 9 / 10).

To be honest it's a little difficult to evaluate your question without
a fuller understanding of your use case.  From what you say so far, it
appears to perhaps be that you want to use %I to use as a hash key
allowing you to select one of several parallel backend services in
some kind of fair manner.  But perhaps that's not what you are really
trying to do.

If however, you are trying to do something like this I would encourage
you to use an auxiliary script to do it.  You could maintain the
sequence number in a file and use advisory locks to arbitrate access
to it, for example.

Thanks,
James.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]