Manipulate JSON with your words
Project description
Partial-sh
Examples
Example single line
Command:
echo '{"name":"Jay Neal", "address": "42 Main St 94111"}' | pt -i "Split firstname and lastname" -i "remove the address"
Output:
{ "first_name": "Jay", "last_name": "Neal" }
Example multi lines
Create data.jsonl
JSON Lines file:
cat << EOF > data.jsonl
{"name":"John Doe","date_of_birth":"1980-01-01", "address": "123 Main St"}
{"name":"Jane Smith","date_of_birth":"1990-02-15", "address": "456 Main St"}
{"name":"Jay Neal","date_of_birth":"1993-07-27", "address": "42 Main St 94111"}
{"name":"Lisa Ray","date_of_birth":"1985-03-03", "address": "789 Elm St"}
EOF
Transform the data:
cat data.jsonl | pt -i "Split firstname and lastname" -i "remove the address"
Output:
{"date_of_birth": "1980-01-01", "first_name": "John", "last_name": "Doe"}
{"date_of_birth": "1990-02-15", "first_name": "Jane", "last_name": "Smith"}
{"date_of_birth": "1993-07-27", "first_name": "Jay", "last_name": "Neal"}
{"date_of_birth": "1985-03-03", "first_name": "Lisa", "last_name": "Ray"}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
partial_sh-0.3.1.tar.gz
(46.5 kB
view hashes)
Built Distribution
partial_sh-0.3.1-py3-none-any.whl
(35.3 kB
view hashes)
Close
Hashes for partial_sh-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1a359e0f3e3477b7ce430697aaaa448884ccaebc90d2d5c09ede2ef705a935c |
|
MD5 | 02bd08b57c61360d6ff3b700eae4b6c5 |
|
BLAKE2b-256 | 8cead6ca98ed02722b3026501fbbf38a3b3ebc4cb961d92f1d562b71d7bf063c |