Questions tagged «select-string»

5
如何从选择字符串中获取捕获的组?
我正在尝试使用Powershell(版本4)从Windows上的一组文件中提取文本: PS > Select-String -AllMatches -Pattern <mypattern-with(capture)> -Path file.jsp | Format-Table 到现在为止还挺好。这给出了一组不错的MatchInfo对象: IgnoreCase LineNumber Line Filename Pattern Matches ---------- ---------- ---- -------- ------- ------- True 30 ... file.jsp ... {...} 接下来,我看到捕获在matchs成员中,因此我将它们取出: PS > Select-String -AllMatches -Pattern <mypattern-with(capture)> -Path file.jsp | ForEach-Object -MemberName Matches | Format-Table 这使: Groups Success Captures Index …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.