2016-03-24 7 views

cevap

0

Bu Where-Object maddesi kapsamında -not operatörü kullanarak için iyi bir durum gibi geliyor: Bu defa var koddur. Örneğin

:

Import-Csv $importFile | 
where {-not $_.Source.StartsWith("10.") -and -not $_.Destination.StartsWith("10.")} | 
Export-Csv $exportFile 

sizin Source ve Destination sütunlar sayısal veri türü, sen .StartsWith() çağırmadan önce kendi değerleri üzerinde .ToString() çağırabilir ile üstesinden gelecektir ihtimali varsa.

Import-Csv $importFile | 
where {-not $_.Source.ToString().StartsWith("10.") -and -not $_.Destination.ToString().StartsWith("10.")} | 
Export-Csv $exportFile 

İpucu

: CSV dosyasını dışa önce Where-Object filtreleme sonuçlarını görmek istiyorsan, ConvertTo-Csv ile Export-Csv $exportFile yerini alabilir. Bu cmdlet, sadece ham CSV dizesini döndürür.

İlgili konular