你好,伟大的磨坊主
http://johnkerl.org/miller/doc
,从
foo: some foo value
bar: another value
baz: 123
foo: another foo value
bar: yet another value
baz: 345
foo: a third foo
bar: a fourth bar
baz: 111
mlr --x2p --ips ": " --barred cat then unsparsify --fill-with "" inputFile
还有这个漂亮的打印输出
+-------------------+-------------------+-----+
| foo | bar | baz |
+-------------------+-------------------+-----+
| some foo value | another value | 123 |
| another foo value | yet another value | 345 |
| a third foo | - | - |
| - | a fourth bar | 111 |
+-------------------+-------------------+-----+
如果您想要CSV,请运行
mlr --x2c --ips ": " cat then unsparsify --fill-with "" inputFile
foo,bar,baz
some foo value,another value,123
another foo value,yet another value,345
a third foo,,
,a fourth bar,111