bugGNU Parallel - build and execute command lines from standard input in parallel - Bugs: bug #37780, Add option to sort input sources...


bug #37780: Add option to sort input sources by header when using --results

Submitted by:  Drew Frank <drewfrank>
Submitted on:  Tue 20 Nov 2012 07:44:28 AM UTC  
Category:  None Severity:  1 - Wish
Item Group:  None Status:  Wont Fix
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Mon 26 Nov 2012 08:42:07 PM UTC, comment #3:

No option added. Sorting implemented in [d47e130]

Ole Tange <tange>
Project Administrator
Mon 26 Nov 2012 07:03:41 AM UTC, comment #2:

Sounds reasonable to me.

Drew Frank <drewfrank>
Project Member
Sun 25 Nov 2012 11:28:32 PM UTC, comment #1:

--result is very special. I do not see any reason why we cannot just sort the arguments every time.

It should be sorted numerically first and asciibetically next:

sort { $a <=> $b or $a cmp $b } @headers

This way no headers (i.e. using 1 .. n as headers) will work as they do now.

Ole Tange <tange>
Project Administrator
Tue 20 Nov 2012 07:44:28 AM UTC, original submission:

This report is related to #37779.

When called with both --header and --results, parallel stores job outputs in result files named according to the their corresponding input values. For example:

./parallel --results foo_ --header : myprog -b {b} -a {a} ::: b 2 ::: a 1

generates the result file:


This example illustrates a fairly vanilla use of the --results option: calling a program with various combinations of command line options. Since many programs are insensitive to the order of their options, it would be nice to be able to tell parallel to generate the same result file name for each of these two commands*:

myprog -b {b} -a {a}
myprog -a {a} -b {b}

A natural choice would be to add an option (e.g., --sort-args) that would sort the arguments according to their header values prior to generating the result file name. If --header was not specified, --sort-args would have no effect.

Personally, I would find this useful because I sometimes rerun commands with the same command line options and expect the output to overwrite the previous result files. Under current behavior, I have to be careful to specify the arguments/input sources in the same order, otherwise I end up with multiple, differing result files containing the same information (relative to my program) in their file names.

  • Note: under current behavior, it is the order of the input sources rather than the substitution strings in the command that determines the output file name (see #37779).
Drew Frank <drewfrank>
Project Member


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by tange (Posted a comment)
  • -email is unavailable- added by drewfrank (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-11-26 tange Severity3 - Normal => 1 - Wish
        StatusNone => Wont Fix
        Open/ClosedOpen => Closed

    Back to the top

    Powered by Savane 3.3