Snæ*_*ørn 5 powershell join pipe
我希望加入管道的结果.
我试过用 -join
PS> type .\bleh.log | where { $_ -match "foo"} | select -uniq | $_ -join ','
Run Code Online (Sandbox Code Playgroud)
但那给了我这个错误:/
表达式仅允许作为管道的第一个元素.
你可以试试这个:
@(type .\bleh.log | where { $_ -match "foo"} | select -uniq) -join ","
Run Code Online (Sandbox Code Playgroud)
在最后一个管道之后你需要一个Foreach-Object(别名%)来使$_变量可用但是它没有用,因为它保存了一个单元格值(对于每个循环迭代).
| 归档时间: |
|
| 查看次数: |
1508 次 |
| 最近记录: |