ptea
asked on
Powershell sort-object
Hi there,
is it possible to use the sort-object cmdlet to sort strings depending on their length? E.g. I have these values in an Array:
111
21
1111
3
I should sort them like this:
3
21
111
1111
How to achieve that?
Cheerio
is it possible to use the sort-object cmdlet to sort strings depending on their length? E.g. I have these values in an Array:
111
21
1111
3
I should sort them like this:
3
21
111
1111
How to achieve that?
Cheerio
ASKER
thx for your response - my description was not detailed enough, in fact the input file (csv) looks like this:
a,b,c
111,bababa,skjskssk
11,snakj,skjasiohio
1234,cjdsh,nsuidn
I should sort the values depending on the values in the column a by the length of the string:
11,snakj,skjasiohio
111,bababa,skjskssk
1234,cjdsh,nsuidn
Cheers
a,b,c
111,bababa,skjskssk
11,snakj,skjasiohio
1234,cjdsh,nsuidn
I should sort the values depending on the values in the column a by the length of the string:
11,snakj,skjasiohio
111,bababa,skjskssk
1234,cjdsh,nsuidn
Cheers
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thx
$Arr = "111", "21", "1111", "3"
$Arr | Sort-Object length