https://github.com/chaostheorie/sponge
Sponge. A moreutils sponge clone
https://github.com/chaostheorie/sponge
cli moreutils python
Last synced: 9 months ago
JSON representation
Sponge. A moreutils sponge clone
- Host: GitHub
- URL: https://github.com/chaostheorie/sponge
- Owner: Chaostheorie
- License: mit
- Created: 2022-04-21T08:41:25.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-21T17:06:12.000Z (about 4 years ago)
- Last Synced: 2025-02-23T15:23:01.046Z (over 1 year ago)
- Topics: cli, moreutils, python
- Language: Python
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sponge — Slurping your pipes
Sponge is a simple python tool for reading from stdin and writing the collected input to a file. It was inspired by [moreutils sponge](https://www.putorius.net/moreutils.html) but rewritten for my personal use as a portable python script. This version of sponge also features the ability to buffer stdin data in a tmp file on disk and later on write in chunks to the destination file for large amounts of data.
The intended use case is for oneliners in POSIX shells: `grep pattern data.txt | sponge data.txt`. Since alternative solutions like `grep pattern data.txt > data.txt` will not work or require writing results in a separate file.
## Usage
`sponge -h`:
```
Usage: sponge [OPTION]... [FILE]
Read full stdin input (until EOF) and write to FILE
-h, --help Print this help message
-t Buffer stdin output in tmp file before writing
-e Read from stderr instead of stdin
```