I am a newbie in Powershell, but this is driving me a bit crazy. I have looked at various questions here, but could not find an answer so here I go. Apologies if this has been covered already.
I have two text files containing columns of numbers. I would like to create an array containing those 2 columns and sort it by column 1 or 2.
If we had
$a=@(1,5,10,15,25)
$b=@(100,99,98,99,10)
we create
c$=$a,$b
My initial thought was to try something like this:
$c | sort { [int]$_[0] }
But it does not work. I have tried many different things so any advice would be appreciated.
I am editing this as my question was not so clear. Ultimately, if I sort $c by ascending column 2, I expect something like:
25,10
10,98
5,99
15,99
1,100
Any idea how to achieve this ?
$c = @(@(1,100),@(5,99),@(10,98),@(15,99),@(25,10))or at least it would be easier to work with like that or if nothing else transform it to work like that.