by alec · 12y ago · 0 comments
Examples:
- sponge: read in all of stdin, then write to the given file. Great for pipelines: sed "s/root/toor/" /etc/passwd | grep -v joey | sponge /etc/passwd
- vipe: easily drop a $EDITOR instance in the middle of a pipe chain
- ts: timestamp all standard input; great for long-running output
https://github.com/skx/sysadmin-util
More focused on those a sysadmin might prefer than general-use, but contributions or updates are welcome.
grep foo <some_file >some_file
But this will have the intended effect: grep foo <some_file | sponge some_file echo data | sudo sponge /etc/a.file
`tee` can be abused in a similar way, but it also prints the data to stdout, which is ugly.sed -i -e 's/root/toor/' -e '/joey/d' /etc/passwd