Skip to main content

PYTHON EDitor: edit lines via Python expressions

Project description

🐉 pythoned

PYTHON EDitor: edit lines via Python expressions

For Pythonistas tired of forgetting the syntax of sed/awk/grep/tr

⬇️ install

pip install pythoned

(it sets up pythoned in your PATH)

✒️ edit

One must simply provide a Python str expression that manipulates the line in the _ variable (an str):

# get last char of each line
echo -e 'f00\nbar\nf00bar' | pythoned '_[-1]'

output:

0
r
r

🛑 filter

If the 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 'len(_) == 3'

output:

f00
bar

📦 modules auto-import

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythoned-0.0.2.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

pythoned-0.0.2-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file pythoned-0.0.2.tar.gz.

File metadata

  • Download URL: pythoned-0.0.2.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

Hashes for pythoned-0.0.2.tar.gz
Algorithm Hash digest
SHA256 36efa4cb48df4f4f7743fb175a26b9128a159af009dab48db0c43a60054fced2
MD5 ba23f582488de053b60f4b54bf5d457a
BLAKE2b-256 b96808c97528fb02e8d02c7529fca628c49bff327a92a9ff7157e0a74870daef

See more details on using hashes here.

File details

Details for the file pythoned-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: pythoned-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pythoned-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d57f02cdd32391dd9cab120bcc476db3f25e40c552aee75a316575e43abe4793
MD5 9440a2c3c2ea949f08bd2d398eb30fea
BLAKE2b-256 dac5df25ca342073f7338a42478cab1852702c83f8342070347d286935861d7b

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