Hello Paul,
You can filter the rows you don't need with where-object and export the results
to a new csv file:
PS > import-csv test.txt | where {$_.user -ne "User3"} | export-csv newTest.txt
---
Shay Levy
Windows PowerShell
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PF> I am trying to using Select-String to exclude a line from a CSV
PF> file,
PF>
PF> e.g.
PF> My CSV file looks like this (I have it in a txt file called
PF> test.txt):
PF> Test.txt
PF> User,FirstName,LastName,DateofBirth
PF> User1,John,Doe,010156
PF> User2,Bob,Doe,050679
PF> User3,Simon,Black,060167
PF> User4,Liza,Green,030886
PF> And I would like to remove User3 so I run the following:
PF>
PF> gc Test.txt | select-string -pattern "," -exclude "User3"
PF>
PF> However my output contains all the users still,
PF>
PF> please could someone help me out as to why this doesn't work????
PF>