{"name":"table-parser","description":"Simple parser for shell-style data output","version":"0.1.3","author":{"name":"Neekey ni184775761@gmail.com"},"keywords":["table parser shell"],"scripts":{"test":"node ./node_modules/mocha/bin/mocha  -t 0 -R spec test/spec.js"},"license":"MIT","main":"index.js","repository":{"type":"git","url":"git+ssh://git@github.com/Neekey/table-parser.git"},"dependencies":{"connected-domain":"^1.0.0"},"devDependencies":{"chai":"^3.5.0","mocha":"^2.4.5"},"gitHead":"16939597f251ff8244b98b0675689a7e188aff2e","bugs":{"url":"https://github.com/Neekey/table-parser/issues"},"homepage":"https://github.com/Neekey/table-parser#readme","_id":"table-parser@0.1.3","_shasum":"0441cfce16a59481684c27d1b5a67ff15a43c7b0","_from":".","_npmVersion":"3.8.6","_nodeVersion":"6.1.0","_npmUser":{"name":"neekey","email":"ni184775761@gmail.com"},"dist":{"shasum":"0441cfce16a59481684c27d1b5a67ff15a43c7b0","tarball":"http://registry-npm.ywwl.com/table-parser/download/table-parser-0.1.3.tgz","integrity":"sha512-LCYeuvqqoPII3lzzYaXKbC3Forb+d2u4bNwhk/9FlivuGRxPE28YEWAYcujeSlLLDlMfvy29+WPybFJZFiKMYg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDo672U0iG3woME/SbLv2inysmZGBz/YKdmQxkGOjzRTwIhAITtI5Qg4tKXCc25GqdVuvH9MDlDBk1PIXPmlJj/0z4N"}],"size":24302,"noattachment":false,"key":"/table-parser/-/table-parser-0.1.3.tgz"},"maintainers":[{"name":"neekey","email":"ni184775761@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/table-parser-0.1.3.tgz_1476779479900_0.34371836320497096"},"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":1476779483260,"_cnpm_publish_time":1476779483260,"dist-tags":{"latest":"1.0.1"}}