I want to fetch a specific column from an output of a command. Can someone please suggest what is the best way to do it?
The command used is - choco list -lo
which gives the output as
Chocolatey v0.10.15
chocolatey 0.10.15
erlang 22.3
rabbitmq 3.8.11
3 packages installed.
And from the given output the only required value is 3.8.11
which is the version of rabbitmq
.
I have already tried this but it does not work - choco list -lo | Select-String -Pattern "rabbit" | %{ $_.Split(' ')[1]; }
Can someone suggest how can we do this?
Thanks in advance :)