Skip to main content

Replacement for tr/sed replace in python

Project description

PyPI version


Text substitution similar to tr or sed s// but without the frustration. Uses plain old python regex style.


Now deployed to pypi, install with:

pip install riptr

This adds the riptr and rtr cli tools to your python environment path.


echo "some example text 1234" > test.file

# default output is stdout
riptr -m "^(.*?)([\d]{2})" -s "\g<1>56" test.file
some example text 5634

# specify patch mode 'p'
riptr -m "^(.*?)([\d]{2})" -s "\g<1>56" -o p test.file
@@ -1 +1 @@
-some example text 1234
+some example text 5634

# or inplace
riptr -m "^(.*?)([\d]{2})" -s "\g<1>56" -o i test.file
cat test.file
some example text 5634

Project details

Download files

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

Files for riptr, version 1.2.2
Filename, size File type Python version Upload date Hashes
Filename, size riptr-1.2.2-py2.py3-none-any.whl (3.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page