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

Re: xargs and max chars



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)...
ta, michael



Assuming that the 'ls -altd' is what you actually want, you might find the '-ls' option to 'find' useful. From the manual:


-ls  True; list current file in ‘ls -dils’ format on standard output.
     The block counts are of 1K blocks, unless the environment  vari‐
     able  POSIXLY_CORRECT  is set, in which case 512-byte blocks are
     used.  See the UNUSUAL FILENAMES section for  information  about
     how unusual characters in filenames are handled.

Not quite the same set of options, but the find will get you the dot files, so you don't need the 'a'. The only problem would be the 't' ;( but maybe you could pipe the 'find' output to 'sort', which shouldn't care about the line length. And the extra columns from the 'i' and 's' options could be removed with awk, sed or cut.

I hope this helps.

Bob

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Reply to: