{"name":"table-parser","description":"Simple parser for shell-style data output","version":"0.0.3","author":{"name":"Neekey ni184775761@gmail.com"},"keywords":["table parser shell"],"main":"index.js","repository":{"type":"git","url":"git@github.com:Neekey/table-parser.git"},"_id":"table-parser@0.0.3","dist":{"shasum":"35640443edc327f9b763d31af9b2ac7ddb5fb6bd","tarball":"http://registry-npm.ywwl.com/table-parser/download/table-parser-0.0.3.tgz","integrity":"sha512-Bhc3OeDPu9MQqk1D9TXTewnhm43Oke0UdCStZSsAAfg38meleNUXWvdgTNPdkkeVyqeP7aUFkBGQLLuAFlN97Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCfC5kBWxN7pwPNsjxcSFaN9Wvo0h9x48a2hKowaibf8wIhAJ+e6hwUMZVRMwp52NHuLGLoYU7uxqwyArR4uue8Reqe"}],"size":10832,"noattachment":false,"key":"/table-parser/-/table-parser-0.0.3.tgz"},"_npmVersion":"1.1.65","_npmUser":{"name":"neekey","email":"ni184775761@gmail.com"},"maintainers":[{"name":"neekey","email":"ni184775761@gmail.com"}],"directories":{},"readme":"TableParser [![Build Status](https://travis-ci.org/neekey/table-parser.svg)](https://travis-ci.org/neekey/table-parser)\n================\n\nA parser to parse table style output from shell\n\n## Install\n\n```\nnpm install table-parser\n```\n\n## Usage\n\nWe have some kind of log below as `test/ps.log`:\n\n```bash\n  PID TTY           TIME CMD\n49692 ttys000    0:00.06 login -pfl neekey /bin/bash -c exec -la bash /bin/bash\n49693 ttys000    0:00.06 -bash\n54195 ttys000    0:00.09 node run\n\n...\n\n56266 ttys005    0:00.06 login -pfl neekey /bin/bash -c exec -la bash /bin/bash\n56269 ttys005    0:00.04 -bash\n56463 ttys005    0:00.09 node test.js\n56464 ttys005    0:00.01 ps -a\n```\n\nUse table-parser to parse it into object:\n\n```\nvar FS = require( 'fs' );\nvar Parser = require('table-parser');\n\nvar linux_ps = './ps.log';\n\ndata = FS.readFileSync( linux_ps ).toString();\nvar parsedData = Parser.parse( data );\n\nconsole.log( parsedData );\n\n```\n\nWhich will output:\n\n```bash\n[ { PID: [ '49692' ],\n    TTY: [ 'ttys000' ],\n    TIME: [ '0:00.06' ],\n    CMD:\n     [ 'login',\n       '-pfl',\n       'neekey',\n       '/bin/bash',\n       '-c',\n       'exec',\n       '-la',\n       'bash',\n       '/bin/bash' ] },\n  ...\n\n  { PID: [ '56464' ],\n    TTY: [ 'ttys005' ],\n    TIME: [ '0:00.01' ],\n    CMD: [ 'ps', '-a' ] } ]\n```\n\n## Double quotation marks\n\nNormally, all the values will be transformed into array using `split( /\\s+/ )`, but string wrapped with `\"` will be treated as a continuous string. \n\nFor example, the CommandLine below:\n\n```\n\"C:\\Program Files\\Internet Explorer\\iexplore.exe\" --name=\"Jack Neekey\" --sex=male otherargs\n```\n\nwill be split into:\n\n- `C:\\Program Files\\Internet Explorer\\iexplore.exe` ( `\"` will be removed, if `\"` is at the beginning )\n- `--name=\"Jack Neekey\"`    ( `\"` is reserved )\n- `--sex=male`\n- `otherargs`\n","publish_time":1359386332708,"_cnpm_publish_time":1359386332708,"dist-tags":{"latest":"1.0.1"}}