Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/delthas/tg
Filter lines of stdout and stderr of a process with simple regex rules
https://github.com/delthas/tg
filter stderr stdout
Last synced: 2 days ago
JSON representation
Filter lines of stdout and stderr of a process with simple regex rules
- Host: GitHub
- URL: https://github.com/delthas/tg
- Owner: delthas
- License: mit
- Created: 2020-02-24T11:36:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-02-24T11:36:41.000Z (over 4 years ago)
- Last Synced: 2024-06-19T15:03:37.139Z (5 months ago)
- Topics: filter, stderr, stdout
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tg [![builds.sr.ht status](https://builds.sr.ht/~delthas/tg.svg)](https://builds.sr.ht/~delthas/tg?)
Filter stdout and stderr of a process with simple regex rules.
## Usage
You want to run `$ bar arg1 arg2 arg3`, but it outputs a lot of unnecessary lines:
```shell
$ bar arg1 arg2 arg3
Barring the foo... (0)
Barring the foo... (1)
Barring the foo... (2)
Barring the foo... (3)
IMPORTANT MESSAGE!!11!
Barring the foo... (4)
Barring the foo... (5)
```You wish to run exactly the program exactly the same, but simply filter out specific line patterns.
Run:
```shell
$ tg -o 'Barring the foo.*' bar arg1 arg2 arg3
IMPORTANT MESSAGE!!11!
```Syntax: `tg [[rule] ...] program [args]`
Each rule is one of:
- `-o `: filter out any stdout line matching `pattern`
- `-e `: filter out any stderr line matching `pattern`
- `-a `: filter out any stdout or stderr line matching `pattern`
- `-O `: only output stdout lines matching `pattern`
- `-E `: only output stderr lines matching `pattern`
- `-A `: only output stdout or stderr lines matching `pattern`
- `-c `: load all rules from a fileRule file format: one rule per line, like this:
```tg
-o Barring the foo.*
-e ^WARNING(40|120|257)$
-c all.tg
```## Builds
| OS | tg |
|---|---|
| Linux x64 | [link](https://delthas.fr/tg/linux/tg) |
| Mac OS X x64 | [link](https://delthas.fr/tg/mac/tg) |
| Windows x64 | [link](https://delthas.fr/tg/windows/tg.exe) |