PYTHON EDitor: a command to edit lines using Python expressions
Project description
🐉 pythoned
PYTHON EDitor: a command to edit lines using Python expressions
For Pythonistas always forgetting the syntax of
sed/awk/grep/tr
install
pip install pythoned
(it sets up pythoned in your PATH)
edit
You provide a Python str expression, manipulating the line stored in the _: str variable:
# get last char of each line
echo -e 'f00\nbar\nf00bar' | pythoned '_[-1]'
output:
0
r
r
filter
If the provided expression is a bool instead of an str, then the lines will be filtered according to it:
# keep only lines whose length equals 3
echo -e 'f00\nbar\nf00bar' | pythoned '"00" in _'
output:
f00
f00bar
generate
If the _ variable is not used in the expression, its value is outputed:
pythoned '"\n".join(map(str, range(5)))'
output:
0
1
2
3
4
modules
Modules are auto-imported, example with re:
# replace digits by Xs
echo -e 'f00\nbar\nf00bar' | pythoned 're.sub(r"\d", "X", _)'
output:
fXX
bar
fXXbar
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pythoned-0.0.4.tar.gz.
File metadata
- Download URL: pythoned-0.0.4.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57964e0cd6e7716db66ce6209944c4c40927af687d0cfb3206f90cd85ed76ff6
|
|
| MD5 |
7b21cbbc9fd9a53d61bf9db1360ea3a3
|
|
| BLAKE2b-256 |
0b24ada54153a10c6f077a93ade0563c0568cb8bb0b40202aaa6b7a6d9a8d18d
|
File details
Details for the file pythoned-0.0.4-py3-none-any.whl.
File metadata
- Download URL: pythoned-0.0.4-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f8ad103ec8842e181b08f46222f5a27ad9c533dda8f3f358e9bb2c0f58094ee
|
|
| MD5 |
2abc6b541e48cd9a5cd3c741a0d41025
|
|
| BLAKE2b-256 |
50e78497ec550c67ddab8690619a7866b37ee6cd90ec5889cdaf3fb06ebf86dd
|