Get-Content -Path E:\test11\data.txt | Sort-Object | Get-Unique
源文件:
AA0001 2014-06-30 15:27:13.073AA0001 2014-06-30 15:27:13.073AA0001 2014-06-30 15:27:13.073AA0002 2014-06-30 15:27:30.607AA0002 2014-06-30 15:28:00.467AA0003 2014-06-30 15:28:20.297AA0003 2014-06-30 15:28:20.297
过滤后:
AA0001 2014-06-30 15:27:13.073AA0002 2014-06-30 15:27:30.607AA0002 2014-06-30 15:28:00.467AA0003 2014-06-30 15:28:20.297
过滤后,另存为新的文件,可以这样:
Get-Content -Path E:\test11\data.txt | Sort-Object | Get-Unique | Out-File -FilePath E:\test11\NewData.txt