Skip to main content

STReam EDitor

Project description

STReam EDitor

stred processes its intput using a Python regular expression, and produces output according to an (optional) replacement string and command-line flags.

It can be used as a replacement for traditional UNIX tools such as grep and sed, offering more advanced functionality.

Features

  • Filter a stream using a regular expression
  • Perform search and replace on a stream using a regular expression
  • Use the jinja templating language to specify replacement strings

Installation

pipx install stred

Usage: stream filtering

Only print matching lines:

stred -g REGEXP

Do case-insensitive matching:

stred -g -i REGEXP

Only print matches, one per line:

stred -g -o REGEXP

Usage: replacement

Replace the string FOO with BAR:

stred FOO BAR

Use positional groups in the replacement (the two are equivalent):

stred -o "http://([^/]+)/([^ ]*)" "\0:\1"
stred -o "http://([^/]+)/([^ ]*)" "\g<0>:\g<1>"

Use named groups in the replacement:

stred -o "http://(?P<host>[^/]+)/(?P<path>[^ ]*)" "\g<host>:\g<path>"

Same thing using jinja templates:

stred -o "http://(?P<host>[^/]+)/(?P<path>[^ ]*)" "{{ host }}:{{ path }}"

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

stred-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

stred-0.1.0-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file stred-0.1.0.tar.gz.

File metadata

  • Download URL: stred-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for stred-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2f2ab66e0abe1e9694313b7901c2867813d6b637e9277fce06c30be8bca3734c
MD5 40c048fd2607704faa75b740accbeea3
BLAKE2b-256 64689ea007bcaac95c4d30b6d89143ad7fec909a9339a48a91be62b677b24246

See more details on using hashes here.

File details

Details for the file stred-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: stred-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for stred-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1ebeb463a0c166f9d9b88b8eebe67d2c769851b263b8b3b81cf39c683d07c6a
MD5 7e157b2d285887f74accf26907911f94
BLAKE2b-256 cce48c9cfdb2202262d3ed4a7c241ce299441f7b2e1bdfd3c7ab7d14274e1eb0

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