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 syntaxes.

⬇️ install

pip install pythoned

(it sets up pythoned in your PATH)

✒️ edit

The provided Python expression must be an str. It manipulates the line available in the _: str variable:

# 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.2rc0.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.2rc0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pythoned-0.0.2rc0.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.2rc0.tar.gz
Algorithm Hash digest
SHA256 00b78f2d6693a343eae7227504234d5d9e84d5aa763eac18e3a51b5e8374e272
MD5 7081cc70401b984750e6f73e494a4a45
BLAKE2b-256 4bebf5d8220a77c4b4ba253ee0c0e4c674a7b262abb7b26b16d49583941260ab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pythoned-0.0.2rc0-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.2rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 336d741feecb67d5c553854949d734291ec3d6beac05f47d4c7a93a3ef5ac211
MD5 3985bcb41b034301136019e0fefcbf83
BLAKE2b-256 f0e9f8640ad5f4c34572a02084d7fb3df82044cabfe12012bd4dcfa6b5685f68

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