Cli utility that parses and transforms text
Project description
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, replace text
-i, insert text
Pysed Examples
See changes before save:
$ 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.
$ 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.
$ 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.
$ pysed -p example.txt
Python is a widely used general-purpose, high-level programming language.
Its design philosophy emphasizes code readability, and its syntax allows
programmers to express concepts in fewer lines of code than would be possible
in languages such as C. The language provides constructs intended to enable
clear programs on both a small and large scale.
$ pysed -s --print 'high-level' 'HIGH LEVEL' example.txt
Python is a widely used general-purpose, HIGH LEVEL programming language.
Its design philosophy emphasizes code readability, and its syntax allows
programmers to express concepts in fewer lines of code than would be possible
in languages such as C. The language provides constructs intended to enable
clear programs on both a small and large scale.
Replace text:
$ cat example.txt
Python is a widely used general-purpose, high-level programming language.
Its design philosophy emphasizes code readability, and its syntax allows
programmers to express concepts in fewer lines of code than would be possible
in languages such as C. The language provides constructs intended to enable
clear programs on both a small and large scale.
$ pysed -s 'high-level' 'HIGH LEVEL' example.txt
$ cat example.txt
Python is a widely used general-purpose, HIGH LEVEL programming language.
Its design philosophy emphasizes code readability, and its syntax allows
programmers to express concepts in fewer lines of code than would be possible
in languages such as C. The language provides constructs intended to enable
clear programs on both a small and large scale.
Insert text:
$ pysed -i 'C' '++' example.txt
$ cat examples.txt
Python is a widely used general-purpose, HIGH LEVEL programming language.
Its design philosophy emphasizes code readability, and its syntax allows
programmers to express concepts in fewer lines of code than would be possible
in languages such as C++. The language provides constructs intended to enable
clear programs on both a small and large scale.
Replace special character:
$ pysed -s '\+\+' '#' example.txt
$ cat example.txt
Python is a widely used general-purpose, HIGH LEVEL programming language.
Its design philosophy emphasizes code readability, and its syntax allows
programmers to express concepts in fewer lines of code than would be possible
in languages such as C#. The language provides constructs intended to enable
clear programs on both a big, small and large scale.
Remove text:
$ pysed -s 'programming ' '' example.txt
$ cat example.txt
Python is a widely used general-purpose, HIGH LEVEL language.
Its design philosophy emphasizes code readability, and its syntax allows
programmers to express concepts in fewer lines of code than would be possible
in languages such as C#. The language provides constructs intended to enable
clear programs on both a big, small and large scale.
More features come….
Project details
Release history Release notifications | RSS feed
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.3.tar.gz
(14.8 kB
view details)
File details
Details for the file pysed-0.0.3.tar.gz
.
File metadata
- Download URL: pysed-0.0.3.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75260c21dc62ac06ea90bca3aa5d1224859c2029b51c0bae59c4a0a6b98757c0 |
|
MD5 | 1a8cb00e1ed5b1243a207c9d3e7047cd |
|
BLAKE2b-256 | b366398d5d791f0660ba777a42ee457fcac0ef7e121099596ad0b632b4f808ca |