我正在尝试在包含用户帐户的文件中过滤掉服务帐户,每行一个:
"svc.test"
"test.user"
"test.user2"
Select-String 添加不需要的元数据:
C:\Output> select-string -Path C:\Output\tmp.csv 'svc' -NotMatch
tmp.csv:415:"test.user"
tmp.csv:416:"test.user2"
我只是想:
"test.user"
"test.user2"
我该怎么做呢?
--- 更新 --- 这是 Get-Member cmdlet 的结果:
PS C:\Output> select-string -Path C:\Output\tmp.csv 'svc' -NotMatch|get-member
TypeName: Microsoft.PowerShell.Commands.MatchInfo
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
RelativePath Method string RelativePath(string directory)
ToString Method string ToString(), string ToString(string directory)
Context Property Microsoft.PowerShell.Commands.MatchInfoContext Context {get;set;}
Filename Property string Filename {get;}
IgnoreCase Property bool IgnoreCase {get;set;}
Line Property string Line {get;set;}
LineNumber Property int LineNumber {get;set;}
Matches Property System.Text.RegularExpressions.Match[] Matches {get;set;}
Path Property string Path {get;set;}
Pattern Property string Pattern {get;set;}
我需要数据。如何将线属性数据输出到文件?