https://github.com/juan-leon/pipe-cutter
Command line tool to filter out some of the data piped in
https://github.com/juan-leon/pipe-cutter
scripts shell shell-script
Last synced: about 2 months ago
JSON representation
Command line tool to filter out some of the data piped in
- Host: GitHub
- URL: https://github.com/juan-leon/pipe-cutter
- Owner: juan-leon
- License: unlicense
- Created: 2021-05-08T13:36:40.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2023-12-01T09:34:53.000Z (over 2 years ago)
- Last Synced: 2025-07-05T06:38:35.160Z (12 months ago)
- Topics: scripts, shell, shell-script
- Language: Rust
- Homepage:
- Size: 59.6 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pipe-cutter
Command line tool to filter out some of the data piped in
[](https://github.com/juan-leon/pipe-cutter/actions/workflows/test.yml)
[](https://deps.rs/repo/github/juan-leon/pipe-cutter)
## What does pipe-cutter?
pipe-cutter is a tool to use as pipe to limit what is read from stdin (in time
or size).
Example: `pipe-cutter --tail nginx.log --seconds 10 > 10-secs.log`
Example: `tail -f nginx.log gnunicorn.log | pipe-cutter --bytes 3000`
```
USAGE:
pipe-cutter [OPTIONS]
FLAGS:
-h, --help
Prints help information
-V, --version
Prints version information
OPTIONS:
--bytes
Stop after reading that many bytes. If reading from stdin, try to honor newlines
--seconds
Stop reading after that many seconds
--tail
Read changes in this file ("tail -f" style), as opposed to using stdin
```
I sometimes use it along [lowcharts](https://github.com/juan-leon/lowcharts) to
visualize chunks of information coming from a logfile/strace/tcpdump/etc.
## Is it really needed?
You can get pipe-cutter functionality by using standard unix tools. For
example, `pipe-cutter --tail FILE --seconds 60 --bytes 10000` could be mimicked
by doing `timeout 60 tail -f FILE | head -c 10000`.
### Installation
#### Via release
Go over https://github.com/juan-leon/pipe-cutter/releases/ and download the binary
you want. Decompress the file and copy the binary to your path.
#### Via local compilation
```
$ git clone https://github.com/juan-leon/pipe-cutter
$ cd pipe-cutter
$ cargo install --path .
```
### Contributing
Feedback, ideas and pull requests are welcomed.