I get a stream of data from an API with which look like this:
redID blueID whiteID 1 22 2 44 15 41 2 15 15 31 2 14
What I need to do, is to sort this by
blueID and then
whiteID and then send somewhere else. But I don't know in advance how many columns there will be. All I know for sure is that there will always be at least those 2 columns.
So the desired output would look like this:
redID blueID whiteID 31 2 14 2 15 15 44 15 41 1 22 2
Is there a way, perhaps in
awk, to sort this stream based on a column name?
The only answer that I'm looking for is in a form of:
inputStream | some operations | sortedInputStream