Link to home
Create AccountLog in
Avatar of Bob
BobFlag for United States of America

asked on

Powershell select-string

When attempting to pull all lines with, ('WilsonK21','integrate','119995
[code]

Open in new window

[/code],*'), in the same line. My results are only pulling all lines with WilsonK21.

String example below:
2020/01/27 17:04:11 pid 9464 WilsonK21@20.Q2.NSI_1_PIR82850.L xx.xxx.xxx.xxx [Helix P4V/NTX64/2019.2/1856742/v86] 'user-integrate -n //depot/MMMMM/CCC_LLLLLLL/DEVBox/LLLLLL_PPPPPPP_MMMM/...@119995,@119995 //depot/MMMMM/CCC_LLLLLLL/DEVBox/LLLLLL_PPPPPPP_MMMM/...'

$LogContent = Get-Content -Path "C:\Temp\Verify_Integrations\Resource_Files\Kelly_Integration_Main_To_Libert_INT_Helix_Log.txt"
$LogContent | Select-String -Pattern ('WilsonK21','integrate','119995') | select line | Out-File C:\Temp\Verify_Integrations\TestOutPut.txt -Width 350 -Encoding ascii

Open in new window

Avatar of oBdA
oBdA

Please clarify all lines with, ('WilsonK21','integrate','119995
Do you want all lines with any of these strings, or with all of them? The former works just fine.
Please provide some sample lines that were not found, even though you expected them to be.
ASKER CERTIFIED SOLUTION
Avatar of footech
footech
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Bob

ASKER

Thank you. Exactly what I was looking for.