I am trying to extra multiple points of data (First, Last, ID number) from a rather nasty log file.
I have this:
Get-Content c:\LOG\22JAN01.log | Out-String |
% {[Regex]::Matches($_, "(?<=FIRST:)((.|\n)*?)(?=LAST:)")} | % {$_.Value}
Which does a fine job of extracting the first name - but I need to also get the last name and ID number from the same line and present them together "BOB SMITH 123456"
Each line of the log file looks like this:
FIRST:BOB LAST:SMITH DOOR:MAIN ENTRANCE ID:123456 TIME:Friday, December 31, 2021 11:55:47 PM INCIDENT:19002304
I would like the output to look something like:
- BOB SMITH 123456
- JACK JONES 029506
- KAREN KARPENTER 6890298
So far I can only manage to get all the first names and nothing else. Thanks for any help pointing me in the right direction!