Simon Anders <[EMAIL PROTECTED]> writes: > However, when two keys are present, this fails to work: > > $ sort -g > [IN ] 5 2 > [IN ] 5 -3 > [OUT] 5 2 > [OUT] 5 -3
You are selecting the whole line as the sort key, and -g then instructs sort to extract the leading numerical prefix from it. Since the lines compare equal on the sort key they are sorted lexicographically as the last resort. If you want to sort numerically on each field on the line you have to specify each sort key separately, like sort -g -k1,1 -k2,2. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
