Im trying to find a way using Select-String and search for exact match in a file, and get all the lines that contains this exact match in exact colum. Example Snippet from data file:
08/25/2021 11:56:03 muzi.puzi 123 Bla
08/25/2021 19:56:03 bla.bla 1234 Bla
08/25/2021 19:56:03 abc.def 54 bla123
Function Get_User_Dates_From_DBFile ([int] $Num, [string] $Db_File){
#Rereive all the dates in DataFile BiometricNum has signed on or off
$Dates = gc $Db_File | Select-String -Pattern "^$BioMetric_Num"
Return ($Date | Sort | Get-Unique)
}
Get_User_Dates_From_DBFile 123 $Db_file
This will give me all Three lines, I want to make sure that it doesnt catch anything more than that (Example 1234) and also make sure it doesnt catch 123 at the end of the last line, as the nubers is refering only to the 4th colounm
Any Advice would be great, Thanks
"\b$num\b"