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.1.tar.gz (4.1 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.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simple_text_replacer-1.0.1.tar.gz
  • Upload date:
  • Size: 4.1 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.1.tar.gz
Algorithm Hash digest
SHA256 91e91d346ef0746f3270a8b2274940074acb4c314a83816737b87f768109d970
MD5 89a1b131c298352ad5b74dc0d676f7a1
BLAKE2b-256 c152734b38790a7c42c86847f078c25a226f1a365f54942f8f4dece165b81e33

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simple_text_replacer-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a98ac9c278418ccaba0e18fb9771361a312b8e0fce3a0fcd3f3b3ad023fdc857
MD5 92e440f69e447f9aa1af5962dedd6bee
BLAKE2b-256 bb12acf703ae5833543c4eefd9371f5b18874b340331a7d7fc4b31d9c0e688df

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