sedpy
sedpy is an open-source project being built as a cross-platform alternative of sed for easier and more flexible stream line editing across BSD and GNU systems.
What is sed and what is sedpy?
The sed command, short for stream editor, performs editing operations on text coming from standard input or a file. sed edits line-by-line and in a non-interactive way.
This means that you make all of the editing decisions as you are calling the command, and sed executes the directions automatically. This may seem confusing or unintuitive, but it is a very powerful and fast way to transform text, especially as part of a script or automated workflow.
The problem with sed is that it's not purely cross-platform. Linux uses GNU-based sed while macOS has the BSD version of sed.As a result - both have quite important sytnatic and usage difference. At the same time, sed though exteremly powerful is quite complex to use.
The sedpy project exactly tries to solve both these problems. The sedpy project intially supports only stream text replacement (supports regex). The future scope of the project is huge and requires continuous feedback and support from all of you amazing folks out there!
Quick Installation
The easiest way to install sedpy is using PyPi pip:
pip install sedpy
or
pip3 install sedpy
Installation using Source:
-
Clone the repo:
git clone https://github.com/mritunjaysharma394/sedpy.git -
Enter the
sedpydirectory:cd sedpy -
Install using:
pip3 install -e .
This should successfully install the sedpy cli package.
As an alternative for Step 3, you can also use:
./install.sh
If ./install.sh fails to work, try running it after changing it's access:
$ sudo chmod a+x install.sh
How to use?
As a sample, you can download the test.txt file. We can play with it to learn about it's very basic usage:
The contents of test.txt file as of now reads:
7 + 4 = 13
We will use sedpy cli to change the '4' to '6' without opening the test.txt file.Just enter below command and see the magic:
sedpy "4" "6" test.txt
NOTE: test.txt argument may differ according to the location where you have stored it.
Now when you open test.txt, file will now read as:
7 + 6 = 13
So you can observe that sedpy can be used as:
sedpy "inital string" "string to replace it" "path to the file where changes have to be made"
Thank you so much for having fun with this! This is just the inital release. More major updates on the cards 🎉
Stay Tuned!
Your contributions are welcome and highly appreciated. All you need to begin is to go through the guidelines in CONTRIBUTING.md
Metadata
Release files for sedpy 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sedpy-1.0.0.tar.gz | 4.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sedpy-1.0.0-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 9.5 kB
Release files / sedpy-1.0.0.tar.gz
| Download URL | sedpy-1.0.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1cb2a5d1b3766fe5667694feb6b6284a54db74e04b8e7205ac5508c54b51d82
|
|
BLAKE2b-256 checksum How to use checksums |
c9fc89b5c983ac9da7ef84a52ecc180b5d73539d37d66efb107fb1d65ed8bd19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.18rc1
|
Release files / sedpy-1.0.0-py2-none-any.whl
| Download URL | sedpy-1.0.0-py2-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
2968134f6f7340f9da5b04f152960e7fc625d6d47effe66fef714e6dd14d72ca
|
|
BLAKE2b-256 checksum How to use checksums |
e8c91cfc6725d8be4231eb4bbb34fc71cda3667405abfdd84aa33f0f37503f31
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.18rc1
|
Security for sedpy 1.0.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.