bug-coreutils
[Top][All Lists]
Advanced

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

[PATCH] add new sort option --xargs (-x)


From: Bo Borgerson
Subject: [PATCH] add new sort option --xargs (-x)
Date: Thu, 3 Apr 2008 12:11:30 -0400

Hi,

The number of inputs that can be handled by the sort utility is
currently limited by what may be passed in argv.

Due to the nature of sort, this limit can't be stepped around with
`xargs' as it could be with some other utilities.

My solution to this locally has been to add an option to the sort
utility, --xargs, which causes sort to treat STDIN as a source of
newline-separated arguments that supplement those on the command-line
(please see attached patch).

Consider the following example with an input directory containing
16384 input files each consisting of a single line with a single
character, one of 'a', 'b' or 'c':

$ src/sort -mu input/*
bash: src/sort: Argument list too long

$ find input/ -type f | xargs src/sort -mu
a
b
c
a
b
c

$ find input/ -type f | src/sort -mu --xargs
a
b
c

Is this an option that might be worth including in a future release?

Thanks,

Bo

Attachment: sort-xargs.diff
Description: Text Data


reply via email to

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