{"name":"table-parser","description":"Simple parser for shell-style data output","version":"1.0.1","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":{"@semantic-release/git":"^4.0.1","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":"826e1142855bde21ee8d70df0c283da9b4a25459","bugs":{"url":"https://github.com/neekey/table-parser/issues"},"homepage":"https://github.com/neekey/table-parser#readme","_id":"table-parser@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"neekey","email":"ni184775761@gmail.com"},"dist":{"integrity":"sha512-LtOZVj3mBWk9ChtZmYy1NCSgWshClqoCzgcj0r0VRY+xm9N4ii2NZyLHVbFhGrWsxVt5uPiVeaZDePoD3krrGA==","shasum":"7c471b8053c54ad5655ec2c3cf676d2b2165d4fb","tarball":"http://registry-npm.ywwl.com/table-parser/download/table-parser-1.0.1.tgz","fileCount":14,"unpackedSize":270607,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCqAs0lqsE+Z5GyHCfBENXAeHd4RPFAyc9rvqKfluMc6gIhAKEcuCVQFhXYHFbHZWX/ioxVrnXgexl/jefPFjy6eFUi"}],"size":24676,"noattachment":false,"key":"/table-parser/-/table-parser-1.0.1.tgz"},"maintainers":[{"name":"neekey","email":"ni184775761@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/table-parser_1.0.1_1523100022656_0.5437338869352497"},"_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":1523100022841,"_cnpm_publish_time":1523100022841,"dist-tags":{"latest":"1.0.1"}}