set abc=( x1 y1 x2 y2 x21 y21 x22 y22 ) set new=`echo $abc | sort -kn` echo $new
The above script gives me the same array.
I expect
x1 x2 x21 x22 y1 y2 y21 y22
Where did I go wrong ?
sort sorts by lines, and you're giving it just a single line of input.
sort
This should work:
set abc = ( x1 y1 x2 y2 x21 y21 x22 y22 ) set new = `echo $abc | fmt -1 | sort -n` echo $new
sort
sorts by lines, and you're giving it just a single line of input.This should work: