Skip to main content

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.

Metadata

Release files for psed 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for psed 0.1.0
File Size Uploaded Provenance
psed-0.1.0.tar.gz 8.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for psed 0.1.0
File Interpreter ABI Platform
psed-0.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 15.4 kB

Release files / psed-0.1.0.tar.gz

Download URL psed-0.1.0.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3bbf8a24bfef9931ce2d134e873546c3053fb857f71b5aee6ecf29f8be143532
BLAKE2b-256 checksum
How to use checksums
0a64842d97167a2f5d5a4b7a9f06edc6e6b0cd21d6dfb5e4214ff25d06b355a7
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / psed-0.1.0-py2.py3-none-any.whl

Download URL psed-0.1.0-py2.py3-none-any.whl
Size 6.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7f713153063c082474155b44c0e928bb9927a5494e386f27f692589399f40ef3
BLAKE2b-256 checksum
How to use checksums
af4103ccba1b329270cf4845dcbf14b8226a4585e9d976867d94e75d68a377b7
Upload date
Uploaded using Trusted Publishing?
What is 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

Security for psed 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page