[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: test suite data

Howard Chu wrote:
Howard Chu wrote:
(all as a single line of text)

Unfortunately the asort() function is a GNU extension, so I think we have to
pipe to the sort command instead:

grep -v '^#' | awk 'BEGIN{FS="\n";RS=""}{j=0; for (i=1; i<=NF; i++){ if ($i ~
/^ /) { x[j] = x[j] "\n" $i; } else { j++; x[j] = $i }} print x[1]; for (i=2;
i<=j; i++){print x[i] | "sort +0";} delete x; close("sort +0"); print ""}'

Oops. Except piping to sort loses the field boundaries, so continuation lines are messed up.

Frankly I ask myself why bothering with such a mess? I know it's hard to introduce another binary dependency but I'd recommend to use a decent (readable) scripting language. Because having to maintain code like the example above will hold people back from writing detailed tests.

Ciao, Michael.