PYTHON EDitor: cli to edit lines via Python expressions
Project description
🐉 pythoned
PYTHON EDitor: CLI tool to edit lines using Python expressions
For Pythonistas tired of forgetting the syntax/options 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
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.3.tar.gz.
File metadata
- Download URL: pythoned-0.0.3.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bf7c0a61d94e7daeebd62d685ed1a3fa9fbff5312b284be274584a2d57b6a26
|
|
| MD5 |
8945e855875de291442198ebd56f184e
|
|
| BLAKE2b-256 |
960623ab1e311ac0f7c6778e8c2f0550a759071955b5ebe243bc47cdc9b758e6
|
File details
Details for the file pythoned-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pythoned-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.6 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 |
73b8f8a1e664ea9711b8f61be5666f9131e04ad7937eb404f473bbba9583bc11
|
|
| MD5 |
966ce08677684085c91ed230b966a072
|
|
| BLAKE2b-256 |
ce67fc6453241ab9663803f45803f088d7d0e0e2d47148321098a898e68c65b9
|