Skip to main content

This provides text replacement by YAML or JSON format.

Project description

Abstract

This is a CLI application that provides string replacement with JSON and YAML files.

Regular expressions are not supported.

Japanse document is here.

How To Install

pip install simple-text-replacer

Package Dependencies

The following packages may not work properly if they are not installed:

  • PyYAML: Most popular YAML parser for Python.

Example

my_pet.txt:

I have one dog and one cat.

replacer.json:

{"dog":"wolf", "cat":"lion"}
> simrep replacer.json my_pet.txt
> cat my_pet.txt
I have one wolf and one lion.

Sytax

simrep <replacer> <text_file>

replacer is in JSON or YAML format.

replacer must be written by key-value like {original_word: replacement_word}.

text_file can also be specified as a directory, but note that in this case, it will replace all files within that directory and its subdirectories.

If you prefer not to overwrite text_file, you can use the -n option to output to a new file or directory.

Options

[-h|--help]

Show help message.

[-v|--version]

Show version message.

[-n|--new] <new file or new directory>

Ouput as an anther file or directory.

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

simple_text_replacer-1.0.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_text_replacer-1.0.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file simple_text_replacer-1.0.0.tar.gz.

File metadata

  • Download URL: simple_text_replacer-1.0.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.3

File hashes

Hashes for simple_text_replacer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 86eea9bd9fbf7ff67053148e76025ac2940e0df8956f2a74151d7c2ff9f4ffdc
MD5 866f9b0d70611689a36b22a696b832b6
BLAKE2b-256 7c1b24a334271e65bcdc76f0be45807b6cdf02efc45e450429f29d675431f791

See more details on using hashes here.

File details

Details for the file simple_text_replacer-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_text_replacer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83188709d59325e6355c393c211dd4a95e8652e476bd0b7c0dacdd54cbf8743f
MD5 4cc87171d9eb0256736d97e483ebb520
BLAKE2b-256 43c934eec032e4fdac71877387da3ac4fefd27e4c40cc3b6ee8b15811a0c2ea9

See more details on using hashes here.

Supported by

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