Skip to content

Table parser omitting a column and adding the value in another column #1

@jviotti

Description

@jviotti

I'm having a small issue with the following input from lsblk:

$ lsblk -d --output NAME,MODEL,SIZE
NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sdb    8:16   1  14.9G  0 disk

If I parse it with table-parser, there is no RM property, and the RM value gets added to MAJ:MIN instead:

tableParser = require('table-parser')

input = '''
    NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    sdb    8:16   1  14.9G  0 disk
'''

parsedData = tableParser.parse(input)
console.log(parsedData)

[ { NAME: [ 'sdb' ],
    'MAJ:MIN': [ '8:16', '1' ],
    SIZE: [ '14.9G' ],
    RO: [ '0' ],
    TYPE: [ 'disk' ] } ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions