I want to search a text file for two strings. The output will only be printed if the first string is greater than 8 characters.
Here is the command I am trying to run:
Get-Content -Path .\std_server*.out | Select-String '((if "cpu=" -gt 8)|application=")' | out-File -width 1024 .\test.txt
So I want to search file std_server*.out for both values CPU and APPLICATION, but I only want to print these values if the value for CPU is greater than 8 characters.
How do I do that?
Currently, I have a basic version that works with '(cpu=|application=")', however that prints out all values of CPU, and I only want the application to be printed out when CPU is an unreasonably high value (CPU > 8).
Thanks in advance.