node.js - Javascript - how to find the PID where match found? -


i have following string buffer (they random rows random column values).

how can search "warnning" in row available, found row, how filter pid?

var exec = require('child_process').exec; exec('tasklist /v /fi "imagename eq python*"', function(a,b,c) {   console.log(b);   // pid contain word : "warnning" ? can list them chronologically?   }); 

output:

image name                     pid session name        session#    mem usage status          user name                                              cpu time window title ========================= ======== ================ =========== ============ =============== ================================================== ============ ===================================================== python.exe                    9999 rdp-tcp#10                 1     19?556 k running         sun\tpt                                                 0:00:15 warnning of windows python.exe                    3861 rdp-tcp#10                 1     19?556 k running         sun\tpt                                                 0:00:15 cancle crap python.exe                    8080 rdp-tcp#10                 1     19?556 k running         sun\tpt                                                 0:00:15 warnning of windows 

in exec filter provide necessary filter in place of running.

exec('tasklist /v /fi "status eq running" /fi "imagename eq shoretel*" /fo csv /nh',      function(a,b,c) {        // function pids       function getpid(csv){           var pids = [];           var lines=csv.split("\n");           for(var i=0;i<lines.length - 1;i++){               var headers=lines[i].split('",');               pids.push(headers[1].split('"')[1]);           }           return pids;       }        // pids       getpid(b); }); 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -