{"name":"table-parser","description":"Simple parser for shell-style data output","version":"1.0.0","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","semantic-release":"semantic-release","travis-deploy-once":"travis-deploy-once"},"license":"MIT","main":"index.js","repository":{"type":"git","url":"git+https://github.com/neekey/table-parser.git"},"dependencies":{"connected-domain":"^1.0.0"},"devDependencies":{"chai":"^3.5.0","mocha":"^2.4.5","semantic-release":"^15.1.5","travis-deploy-once":"^4.4.1"},"gitHead":"bb7428d4c0e7d424ad77574f5c2f68ece0da8e4f","bugs":{"url":"https://github.com/neekey/table-parser/issues"},"homepage":"https://github.com/neekey/table-parser#readme","_id":"table-parser@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"neekey","email":"ni184775761@gmail.com"},"dist":{"integrity":"sha512-chtgWl5u6PiGDVu4Ap91f7xVFAfJMPJkYHkT6M91oY3NRVT7fSaqFI0sMJ3Mj7p3HIN6ME/3109iYgkaYJbI6g==","shasum":"18fea7dbbdff266eef48d8093d4d3bbdcb6bd30b","tarball":"http://registry-npm.ywwl.com/table-parser/download/table-parser-1.0.0.tgz","fileCount":13,"unpackedSize":270294,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDABuw16hgLuTsRbOF/scnJ5zP86JnJmRf61o/7LC6IiAiB3+HOOBXjtzii1LwEVLOpLrcZvEV0SriOzJfheS1OmGg=="}],"size":24506,"noattachment":false,"key":"/table-parser/-/table-parser-1.0.0.tgz"},"maintainers":[{"name":"neekey","email":"ni184775761@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/table-parser_1.0.0_1523095896205_0.9510624136069767"},"_hasShrinkwrap":false,"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":1523095896282,"_cnpm_publish_time":1523095896282,"dist-tags":{"latest":"1.0.1"}}