Skip to main content

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


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.5.2.tar.gz (69.0 kB view details)

Uploaded Source

Built Distribution

partial_sh-0.5.2-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

Details for the file partial_sh-0.5.2.tar.gz.

File metadata

  • Download URL: partial_sh-0.5.2.tar.gz
  • Upload date:
  • Size: 69.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.0 CPython/3.12.1 Linux/6.5.11-linuxkit

File hashes

Hashes for partial_sh-0.5.2.tar.gz
Algorithm Hash digest
SHA256 ddf88c9dc813401d91c0f22886fbe7450f560202ff81ef637202760fbab627fc
MD5 959aaa1a62162593226ed3634fdaeea3
BLAKE2b-256 ba195c382473f5a987f4f4787fd705cc517e968c1ec2d5ec94eac94c07be72ea

See more details on using hashes here.

File details

Details for the file partial_sh-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: partial_sh-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 33.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.0 CPython/3.12.1 Linux/6.5.11-linuxkit

File hashes

Hashes for partial_sh-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 67d0650ca74d35ad8623fbb8c227bfb44e093bca2054fcbf93bfc5ee8a8ff81e
MD5 4a10de56b8f2322d6869dc89d8f3df3f
BLAKE2b-256 f1d5d329ffc461ba62c75ad721c0324658534bab4c061c00c09c4e7ad27fc376

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page