Hi,
I'm trying to extract rows from a csv file that meet a certain pattern (three characters and 8 digits) but cannot get it to work. see below code and an example of the csv file
#Import the CSV file with all the data.
$csv = Import-CSV J:\CanvasData\users_utf8nobom.csv
#Process the CSV file one row at a time
foreach ($row in $csv) {
#Each column is accessed using the column header.
#We can use the -not operator to specify 'doesn't match'.
if ($row.user_id -eq "\b[\D[3}\d{8}]\b")
{
#... Export that row to a new CSV file.
$row | Export-CSV J:\Temp\teacherlist.csv -Append -NoTypeInformation
}
}
user_id
|
status
|
MCN18158364
|
active
|
901658
|
active
|
W00054
|
active
|
MCN17125917
|
active
|