Skip to content

jridgewell/rw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rw

Like sponge, but without the moreutils kitchen sink.

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!

# 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

rw [-a] FILE

Appending to file

Giving the -a (--append) flag will append to the output file, instead of overwritting it.

About

Like sponge, but without the moreutils kitchen sink

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages