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.csv"
$data= import-csv $file
$results= $data | where {$_.Username -eq "Sam Blackman"}
$results
$file= "C:\Users\Nick\Downloads\data.csv"
$data= import-csv $file
$results= $data | where {$_.Username -like "*Sam*"}
$results
$file= "C:\Users\Nick\Downloads\data.csv"
$data= import-csv $file
$results= $data | where {$_.ID -le "5"}
$results |ft | out-file test13.txt
$file= "C:\Users\Nick\Downloads\data.csv"
$data= import-csv $file
$results= $data | where {($_.Location -notlike "Seattle") -and ($_.Location -notlike "Washington DC")}
$results
This video is brought to you by https://www.lockard.it
Watch video How To Powershell Import CSV And Parse Data Out Of CSV Using Comparison Operators online without registration, duration hours minute second in high quality. This video was added by user Lockard 16 October 2018, don't forget to share it with your friends and acquaintances, it has been viewed on our site 15,71 once and liked it 15 people.