PowerShell: filter string list

前端 未结 2 1244
太阳男子
太阳男子 2021-02-20 08:55

This seems like a very basic thing to do, but I am new to PowerShell and can\'t figure this out or find an example online...

I am trying to filter a list of strings. Thi

相关标签:
2条回答
  • 2021-02-20 09:17

    Use:

    svn list -R PATHTOREPOSITORY | where {$_ -like "*stringtomatch*"}
    
    0 讨论(0)
  • 2021-02-20 09:32

    You might consider using -match instead of -like. -Match is more powerful (regex based) and will work like you were initially expecting:

    svn list -R PATHTOREPOSITORY | where {$_ -match 'stringtomatch'} 
    
    0 讨论(0)
提交回复
热议问题