Link to home
Start Free TrialLog in
Avatar of samiam41
samiam41Flag for United States of America

asked on

Filter echo results from batch file output

Hey Experts.  I have a small batch file that outputs the results of pslist (processes running on computer) into a log file.  The output is great but I'm wanting to exclude certain things from ending up in the log file.  How do I control what is echo'd or parse the results in the log file?  Here is a small sample of what is in the log file:


Wed 03/09/2016 10:39:45.97
Process information for PC1:

Name                Pid Pri Thd  Hnd   Priv        CPU Time    Elapsed Time
Idle                  0   0   4    0      0  1194:25:03.642   325:47:59.227
System                4   8 156  684    608     0:49:39.182   325:47:59.227
smss                332  11   2   32    544     0:00:00.156   325:47:59.102
csrss               548  13   9  977   3032     0:00:22.074   325:47:53.096
wininit             620  13   3   81   2244     0:00:00.109   325:47:49.570
csrss               644  13  18  959  24484     0:31:05.631   325:47:49.555
services            688   9   6  359  10420     0:00:59.670   325:47:49.445
lsass               712   9  10 1268  10848     0:03:33.705   325:47:49.367
lsm                 720   8   9  198   3268     0:00:04.664   325:47:49.367
winlogon            824  13   3  134   3772     0:00:00.577   325:47:48.681
svchost             888   8  12  421   6448     0:01:22.290   325:47:45.031
nvvsvc              952   8   5  116   3264     0:00:00.140   325:47:44.968
nvwmi64             976   8   3   63   2064     0:00:00.062   325:47:44.719
nvSCPAPISvr        1000   8   6  100   3032     0:00:34.788   325:47:44.703
svchost             116   8  10  492   7712     0:01:24.380   325:47:43.985
svchost             764   8  20  599  29556     0:02:04.426   325:47:43.502

I'd like to filter out the "svchost" and "chrome" results.  I'm aware that there might be Powershell options but I'd like to keep the batch file.  Thanks for your help.
SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of samiam41

ASKER

oBdA!!  Hey mate.  It's been awhile.  Thanks for the response.  Testing now.
Simply, 100% amazing what you come up with.  You need to donate your brain to science as your knowledge is just freakish...

It works.  Is there any limit to the amount of /c that can be used?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Phenomenal expert
Thanks for the explanation.  That will help as I try to tweak this further.