Channel | Publish Date | Thumbnail & View Count | Actions |
---|---|---|---|
| 2018-10-17 00:59:50 | ![]() 15,934 Views |
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
Please take the opportunity to connect and share this video with your friends and family if you find it useful.