I have the following Korn shell variable which I need to output in sorted order (by field 1 with delimiter ,)
# Original list = "4,Test1,a,b 5,Test2,g,o 2,Test6,a,q
1,Test2,a,c"
# Required list = "1,Test2,a,c 2,Test6,a,q 4,Test1,a,b
5,Test2,g,o"
IN="4,Test1,a,b 5,Test2,g,o 2,Test6,a,q
1,Test2,a,c"
OUT=`echo $IN | sort -k1`
echo $OUT
How do I sort this list ?
# Original list = "4,Test1,a,b 5,Test2,g,o 2,Test6,a,q
1,Test2,a,c"
# Required list = "1,Test2,a,c 2,Test6,a,q 4,Test1,a,b
5,Test2,g,o"
IN="4,Test1,a,b 5,Test2,g,o 2,Test6,a,q
1,Test2,a,c"
OUT=`echo $IN | sort -k1`
echo $OUT
How do I sort this list ?