Skip to content
Snippets Groups Projects
psnj-split.asciidoc 845 B
Newer Older
hondet's avatar
hondet committed
= PSNJ-SPLIT(1)
:Date: 2021-11-17

== NAME

hondet's avatar
hondet committed
psnj-split - Split a list of JSON objects across multiple files
hondet's avatar
hondet committed
psnj-split [-p PREFIX]
hondet's avatar
hondet committed
*psnj-split* reads a newline-seprated list of json objects on its standard input and copies
each object to a file +PREFIX_s.json+ where +s+ is the value associated to
the (json) name _name_.

== EXIT STATUS

hondet's avatar
hondet committed
*psnj-split* exits with 0 on success.

== EXAMPLE

Faced with input

----
{ "name": "foo", "bar": "lorem ipsum dolor" }
{ "name": "bar", "bar": "dolor sit amet" }
{ "name": "foo", "bar": "consectetur" }
----

hondet's avatar
hondet committed
+psnj-split -p frobnify+ produces two files with the following content:

.frobnify_foo.json
----
{ "name": "foo", "bar": "lorem ipsum dolor" }
{ "name": "foo", "bar": "consectetur" }
----

and

.frobnify_bar.json
----
{ "name": "bar", "bar": "dolor sit amet" }
----