Войти
  • 16089Просмотров
  • 7 лет назадОпубликованоLockard

How To Powershell Import CSV And Parse Data Out Of CSV Using Comparison Operators

How To Powershell Import CSV And Parse Data Out Of CSV Using Comparison Operators. Using the import-csv cmdlet with where-object and parse the data out of the CSV file using comparison operators: -eq Equal -ne Not equal -ge Greater than or equal -gt Greater than -lt Less than -le Less than or equal -like Wildcard comparison -notlike Wildcard comparison Logical operators -and Logical And Examples: $file= "C:\Users\Nick\Downloads\ " $data= import-csv $file $results= $data | where {$ -eq "Sam Blackman"} $results $file= "C:\Users\Nick\Downloads\ " $data= import-csv $file $results= $data | where {$ -like "*Sam*"} $results $file= "C:\Users\Nick\Downloads\ " $data= import-csv $file $results= $data | where {$ -le "5"} $results |ft | out-file $file= "C:\Users\Nick\Downloads\ " $data= import-csv $file $results= $data | where {($ -notlike "Seattle") -and ($ -notlike "Washington DC")} $results This video is brought to you by