unix shell, redirect output but keep on stdin
Use tee
:
./child | tee file
tee
will copy its standard input to any file on the command line and to standard output as well.
I use: sponge, from moreutilshttp://linux.die.net/man/1/sponge
you can do something like that:
$ grep something largefile | sponge largefile