Im trying to extract the loankey from the following text in powershell:
Test\errorlog.txt:4::293:StepName:WARNING StepTime:9/9/2016 9:01:06 AM StepMessage:ERROR(KEY1:7798850,LOANKEY:11111)::POST PAYMENT StepNotes:[[WARNING]]
Test\errorlog.txt:8::299:StepName:WARNING StepTime:9/9/2016 9:01:11 AM StepMessage:ERROR(KEY1:7798870,LOANKEY:54321)::POST PAYMENT StepNotes:[[WARNING]]
Test\errorlog.txt:12::305:StepName:WARNING StepTime:9/9/2016 9:01:14 AM StepMessage:ERROR(KEY1:7798863,LOANKEY:12345)::POST PAYMENT StepNotes:[[WARNING]]
I have currently got the following to filter down the error log down to how you see it above:
cls
$path = 'C:\Test\errorlog.txt'
$script = select-string -pattern "LOANKEY:" $path