How to sort columns using bash script?

I would like to do the sorting from left to right, and not from top to bottom, as usual. Is there any simple command for this in bash other than moving data back and forth? In my opinion, data transfer will add unnecessary code complexity.

Here is the entry

Carol Adam Dean Bills 0.88 0.57 0.43 0.70 black green white purple 

And here is a sorted result based on the data in the first row

 Adam Bills Carol Dean 0.57 0.70 0.88 0.43 green purple black white 

I don’t think this problem is unusual, so I have Google and search in this stack, but I haven’t found simple solutions.

+1
source share

Source: https://habr.com/ru/post/1205278/


All Articles