linesieve
This is my text munging tool. There are many like it, but this one is mine.
linesieve is an unholy blend of grep, sed, awk, and Python, born out of spite.
Features
linesieve
allows you to:
split text input into sections
apply filters to specific sections
search and highlight success/failure markers
match/sub/split with the full power of Python’s re
shorten paths, links and module names
chain filters into pipelines
color output!
Installing
Install and update using pip:
$ pip install --upgrade linesieve
A simple example
$ ls -1 /* | linesieve -s '.*:' show bin match ^d head -n2
.....
/bin:
dash
date
......
/sbin:
disklabel
dmesg
...
This prints the first two files starting with d
from each directory whose name contains bin
(skipped directories are marked with a dot on stderr).
Links
PyPI Releases: https://pypi.org/project/linesieve/
Documentation: https://linesieve.readthedocs.io/
Issue Tracker: https://github.com/lemon24/linesieve/issues
Source Code: https://github.com/lemon24/linesieve