Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

power shell How to Ignore lines with StreamWriter WriteLine

filter timestamp {
    # if this output is purely whitespace or it matches `00000` 
    if([string]::IsNullOrWhiteSpace($_) -or $_ -match '00000') {
        # skip it
        return 
    }
    $sw.WriteLine("$(Get-Date -Format MM/dd/yyyy_HH:mm:ss) $_")
}
 
PREVIOUS NEXT
Tagged: #power #shell #How #Ignore #lines #StreamWriter #WriteLine
ADD COMMENT
Topic
Name
6+5 =