8 ffilt - Filter a file via a command's STDIO and write back to it
12 ffilt I<FILE> I<COMMAND> [I<ARGS>]
16 Feed I<FILE> into I<COMMAND>'s stdin, then save its stdout back to I<FILE>
17 if I<COMMAND> ran successfully.
19 Similar to this shell script:
21 output=`cat I<FILE> | I<COMMAND>`
22 [ $? = 0 ] && echo "$output" > I<FILE>
28 sponge(1), insitu(1) L<https://github.com/athas/insitu>
39 .
/usr
/lib
/tool
/bash-utils
58 errx
-1 "unknown option: $1";;
72 stdout
=`cat "$file" | command "$@"`
73 # pipefail make us die here if either cat or command failed
74 cat > "$file" <<< "$stdout"