Skip to main content

PYTHON EDitor: a command to edit lines using Python expressions

Project description

unittest pypi

🐉 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


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.4rc0.tar.gz (3.2 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.4rc0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for pythoned-0.0.4rc0.tar.gz
Algorithm Hash digest
SHA256 4b3f378c1a2bfca67fef4e1baf39b99c1af426e5233c7ad7c751d57b0502269f
MD5 0e7d14fb40957cadd2030fc8d23f89ee
BLAKE2b-256 1073f5bde1987f4125ef6d133c0751d6466cffa934275fe3ee077795146ed6f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pythoned-0.0.4rc0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 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.4rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d07b0129fb0cf405f0f42aaf50433d7aa288216ceab289289b9f1cc63d21d68
MD5 72b58144f5f83c48c0d9fe753227ccbb
BLAKE2b-256 dc3eee09d69e021a65b787c005e826c77b917cac4adbea365f2c2f5b42950f67

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