Albert Widjaja
asked on
PowerShell script to list the file with specific pattern in the directories including its line number.
Hi,
I need some help with the PowerShell script modification below so that it can also show, which line number the search pattern showed up?
I'm not the expert in RegEx, hence I am using the basic.
Thanks in advance.
I need some help with the PowerShell script modification below so that it can also show, which line number the search pattern showed up?
$FileType = '*.log'
$SearchPath = '\\PRODFS01-VM\Logs'
$SearchPattern = 'Error'
Get-ChildItem -Include $FileType -Recurse -Path $SearchPath | Select-String -Pattern $SearchPattern | Sort-Object -Unique -Property Path | Select-Object Path
I'm not the expert in RegEx, hence I am using the basic.
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER