Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jridgewell/rw
Like sponge, but without the moreutils kitchen sink
https://github.com/jridgewell/rw
Last synced: 2 months ago
JSON representation
Like sponge, but without the moreutils kitchen sink
- Host: GitHub
- URL: https://github.com/jridgewell/rw
- Owner: jridgewell
- License: mit
- Created: 2019-04-28T11:05:01.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-11T02:58:09.000Z (about 4 years ago)
- Last Synced: 2024-10-03T09:18:27.040Z (3 months ago)
- Language: Rust
- Size: 12.7 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rw
Like [sponge](https://joeyh.name/code/moreutils/), but without the moreutils kitchen sink.
```bash
cat example.txt | grep -v exclude | rw example.txt
````rw` ("rewrite") allows you to redirect the stdout of one command into a file, even if you're using that file to generate the stdout. If you were to try that with standard shell redirection, you would end up truncating the file before you could read it!
```bash
# This causes example.txt to be empty
# Shell redirection would truncate the file, before the cat utility read it
cat example.txt | grep -v exclude > example.txt
```## Usage
```bash
rw [-a] FILE
```### Appending to file
Giving the `-a` (`--append`) flag will append to the output file, instead of overwritting it.