【发布时间】:2019-02-28 23:18:45
【问题描述】:
我有以下 CSV 文件:
"Count";"Computername";"Files and paths"
"3";"Computer1";"%OSDRIVE%\USERS\0000008\APPDATA\LOCAL\TEMP\__PSSCRIPT.PS1"
"1";"Computer1";"%OSDRIVE%\USERS\0000008\APPDATA\LOCAL\TEMP\__PSSCRIPT.PS1"
"5";"Computer3";"\\SRV\TOTO$\HELLO.BAT"
"8";"Computer4";"\\192.168.8.18\TOTO\DNS.BAT"
"10";"Computer15";"%OSDRIVE%\Hello.exe"
"12";"Computer6";"\\SRV\SCRIPTS\REBOOT.BAT"
"88";"Computer7";"%OSDRIVE%\Winword.exe"
"154";"Computer2";"%OSDRIVE%\excel.exe"
我想保留“计数”大于或等于 8 的所有行。
我尝试了以下命令:
Import-Csv -Path MyFile.csv -Delimiter ";" | Where-Object {$_.Count -ge 8}
但它只返回给我 8 或 88 或 18 的行...而不是所有其他行高于 8 (如 10、12、154 ...)。
为什么?
【问题讨论】:
标签: powershell int filtering import-csv