Last active
January 19, 2024 16:21
-
-
Save bigornoo/8c7a617808a1df3d926659dab7e99d4b to your computer and use it in GitHub Desktop.
Sort 1 line file (https://unix.stackexchange.com/questions/436102/how-can-i-numerically-sort-a-single-line-of-delimited-items)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gawk -v SEP=', ' '{ i=0; split($0, arr, SEP); len=asort(arr); | |
while ( ++i<=len ){ printf("%s%s", i>1?SEP:"", arr[i]) }; | |
print ""}' infile |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment