Created
January 28, 2022 18:39
-
-
Save mwjcomputing/75a04758e39a20716eaa4362e3da50f0 to your computer and use it in GitHub Desktop.
Revisions
-
mwjcomputing revised this gist
Jan 28, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,5 +25,7 @@ function New-MTail { Written by Matthew Johnson (@mwjcomputing) .LINK https://mwjcomputing.com .LINK https://gist.github.com/mwjcomputing/75a04758e39a20716eaa4362e3da50f0 #> } -
mwjcomputing created this gist
Jan 28, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ function New-MTail { param ( [Parameter(Mandatory = $true)] [string]$File, [Parameter(Mandatory = $true)] [string]$SearchTerm ) Get-Content -Path $File -tail 100 -wait | Select-String $SearchTerm <# .SYNOPSIS Does a PowerShell tail .DESCRIPTION Does a PowerShell tail for the last 100 lines from file. .EXAMPLE PS C:\> New-MTail -File log.txt -SearchTerm error Sets the Windows 11 Theme to light mode. .INPUTS System.String. The path to the file to tail. System.String. The search term to trigger on. .OUTPUTS None .NOTES Written by Matthew Johnson (@mwjcomputing) .LINK https://mwjcomputing.com #> }