Skip to main content

A convenience script to search and replace strings in files.

Project description

search-replace is a trivial Python script that implements search/replace in text files.

https://github.com/luismsgomes/search-replace

Copyright (c) 2019 Luís Gomes <luismsgomes@gmail.com>

Usage

search-replace <json-table> [<input-file> [<output-file>]]

Where <json-table> is either:

  • an object with search strings as keys and replacement strings as values, e.g. {"search": "replace"}

  • an array of arrays containing search and replacement string pairs, e.g. [["search1", "replace1"], ["search2", "replace2"]]

  • a filename preceeded by @, such as @table.json, and the file should contain the replacement table in one of the two JSON formats described above

In the second form, the order of replacements is ensured to follow the order of the array.

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

search-replace-0.1.2.tar.gz (2.3 kB view details)

Uploaded Source

File details

Details for the file search-replace-0.1.2.tar.gz.

File metadata

  • Download URL: search-replace-0.1.2.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.20.1 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for search-replace-0.1.2.tar.gz
Algorithm Hash digest
SHA256 91022453bc034c1f1cf1a0c77dc089deb751f172dcc49786325b12e9aac9452a
MD5 9999c846abed5ac10144467e6acaa90d
BLAKE2b-256 9a7f1b419e4b994796d79e97a828ec86c48a61e10d1c2db707ca00af2d0d517f

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