Skip to main content

PYTHON EDitor: edit lines via Python expressions

Project description

pythoned

PYTHON EDitor: edit lines via Python expressions

For those knowing Python and tired of forgetting sed/awk/grep/tr syntaxes.

install

pip install pythoned

(it installs pythoned in your PATH)

edit

The provided Python expression must be an str. It manipulates the line stored in the variable _: 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 containing a zero
echo -e 'f00\nbar\nf00bar' | pythoned '"0" in _'

output:

f00
f00bar

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.1.tar.gz (2.7 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.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pythoned-0.0.1.tar.gz
  • Upload date:
  • Size: 2.7 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.1.tar.gz
Algorithm Hash digest
SHA256 ebcf0d47a762194f65cfbe6299e6e1507bfe83413b46b62d562b5c7b44c77ac1
MD5 98faff8a5f6204b870ab1cbcfe6c57e8
BLAKE2b-256 bf08f0b95988fa6dfca3ee87f3efb638fdba4bb6585e543a28688bd763190dfa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pythoned-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cfff083e6ecdb0e9819c2885f828159b7cbdc490dc0fe5d59b9b2e1bdbc637dd
MD5 128094eaacfaea620b9fa0b0d8ffc590
BLAKE2b-256 8540e1b755c36992d3871ad70a81abfe24431b7e6dd391b4f9cd13bbec1ad93b

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