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

Re: xargs and max chars



On Wed, Nov 01, 2006 at 05:39:06PM +0000, michael wrote:
> Anybody got a quick solution to how to use xargs in corp with, say, find
> and ls when there's more chars than xarg (see -s) likes for a single
> run?
> 
> eg if I run
>  find . -name 'me*' -print | xargs ls -altd
> and find gives more than circa 20k chars then it appears that ls is run
> multiple times with the output concat-ed ie you get groups of date
> sorted files rather than a single list of date sorted files... (giving
> xargs the '-x' aborts the above cmd indicating find returns more chars
> than xargs can handle on a single run)... 
> 
That's the purpose of xargs, to handle longer lists of arguments than 
the shell or the kernel can handle in a single run, by breaking them 
into multiple runs.  How then can you get a single list of files sorted 
by date?  You could use find -printf, with a format string beginning 
with "%Ts", and pipe the output to sort -n.


-- 
It would be possible to optimize some forms of goto, but I haven't
bothered.
             -- Larry Wall in <199709041935.MAA27136@wall.org>



Reply to: