Skip to main content

CLI utility that parses and transforms text

Project description

https://badge.fury.io/py/pysed.png https://pypip.in/d/pysed/badge.png https://pypip.in/license/pysed/badge.png

Cli utility that parses and transforms text written in Python.

[CHANGELOG] : https://github.com/dslackw/pysed/blob/master/CHANGELOG

Installation

$ pip install pysed

uninstall

$ pip uninstall pysed

Command Line Tool Usage

usage: pysed [-h] [-v] [-p] [-s] [-i]

Utility that parses and transforms text

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         print version and exit
  -p, --print           print text
  -s, m /               replace text
  -i, m /               insert text

Pysed Examples

See changes before modification with options -p –print:

Print text file:

(NOTE: Windows users avoid using quotes ‘’)

$ pysed --print text.txt

This is my cat,
 whose name is Betty.
This is my dog,
 whose name is Frank.
This is my fish,
whose name is George.
This is my goat,
 whose name is Adam.

Remove new lines:

$ pysed -s --print '\n ' ' ' text.txt

This is my cat, whose name is Betty.
This is my dog, whose name is Frank.
This is my fish,
whose name is George.
This is my goat, whose name is Adam.

Redirect results to another file:

$ pysed -s --print '\n ' ' ' text.txt > text2.txt
$ cat text2.txt

This is my cat, whose name is Betty.
This is my dog, whose name is Frank.
This is my fish,
whose name is George.
This is my goat, whose name is Adam.

Replace text:

$ pysed -s --print 'This' 'THIS' text.txt

THIS is my cat,
 whose name is Betty.
THIS is my dog,
 whose name is Frank.
THIS is my fish,
whose name is George.
THIS is my goat,
 whose name is Adam.

Replace max:

$ pysed -s --print m2/'This' 'THIS' text.txt

THIS is my cat,
 whose name is Betty.
THIS is my dog,
 whose name is Frank.
This is my fish,
whose name is George.
This is my goat,
 whose name is Adam.

Insert text:

$ pysed -i --print 'whose ' 'sur' text.txt

THIS is my cat,
 whose surname is Betty.
THIS is my dog,
 whose surname is Frank.
This is my fish,
whose surname is George.
This is my goat,
 whose surname is Adam.

Insert max:

$ pysed -i --print m2/'whose ' 'sur' text.txt

THIS is my cat,
 whose surname is Betty.
THIS is my dog,
 whose surname is Frank.
This is my fish,
whose name is George.
This is my goat,
 whose name is Adam.

More features come….

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

pysed-0.0.6.tar.gz (15.1 kB view details)

Uploaded Source

File details

Details for the file pysed-0.0.6.tar.gz.

File metadata

  • Download URL: pysed-0.0.6.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pysed-0.0.6.tar.gz
Algorithm Hash digest
SHA256 4d010e0ad2df3a558364bf349d43d17541cc265cfb407ea65bcaf098ca5c1c6d
MD5 6e1baa75c79c24d6bbace3d4d48539d7
BLAKE2b-256 72d73462f18571d6dbbe92fa2b42768a35417938a56e45a99bcff1a27d338699

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page