Skip to main content

CLI utility for text search / replace.

Project description

psed

CLI utility for text search / replace.

This project is a simple replacement for the sed in Linux. I had enough issues with debugging the regular expressions, especially a few months after they were written, so I have created a replacement in Python. Feel free to use it, but the project aimed to cover my use case so it might not fit everybody. I plan to improve functionality in the future.

Installation and usage

To install, simply run pip install command. You need at least Python 3.6 interpreter.

pip install psed

Usage:

$ psed --help

Usage: psed [OPTIONS]

  Console script for psed.

Options:
  -i, --input TEXT    Path to the input file / directory.  [required]
  -f, --find TEXT     String to find.
  -r, --replace TEXT  String to replace.
  --inplace           Modify the file(s) in place.
  -v, --verbose       Increase verbosity.
  --version           Show the version and exit.
  --help              Show this message and exit.

Usage example

Input file:

[ERROR] Some error
[INFO] Some info
[WARNING] Some warning
[ERROR] Other error
[ERROR] There's a lot of errors
[DEBUG] And one debug

Run psed:

psed --input ./sample \
     --find '\[(ERROR)\]' \
     --find '\[(INFO)\]' \
     --find '\[(WARNING)\]' \
     --replace '[LIGHT_\1]'

Output file:

[LIGHT_ERROR] Some error
[LIGHT_INFO] Some info
[LIGHT_WARNING] Some warning
[LIGHT_ERROR] Other error
[LIGHT_ERROR] There's a lot of errors
[DEBUG] And one debug

History

0.1.0 (2019-08-26)

  • First release on PyPI.

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

psed-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

psed-0.1.0-py2.py3-none-any.whl (6.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file psed-0.1.0.tar.gz.

File metadata

  • Download URL: psed-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.0

File hashes

Hashes for psed-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3bbf8a24bfef9931ce2d134e873546c3053fb857f71b5aee6ecf29f8be143532
MD5 428ac1202bce8ec97a9d3b0000c9fdb3
BLAKE2b-256 0a64842d97167a2f5d5a4b7a9f06edc6e6b0cd21d6dfb5e4214ff25d06b355a7

See more details on using hashes here.

File details

Details for the file psed-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: psed-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.0

File hashes

Hashes for psed-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7f713153063c082474155b44c0e928bb9927a5494e386f27f692589399f40ef3
MD5 bb35fdd11c5d866348b4f42f0905f59a
BLAKE2b-256 af4103ccba1b329270cf4845dcbf14b8226a4585e9d976867d94e75d68a377b7

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