I'm trying to duplicate a command's output so I apply a post-treatment to one stream, then store it to a file while printing the original one on stdout.
Closest I could come with is:
command | tee /dev/stdout | sed 's/foo/bar/g' > out.txt
which does not work as the >
captures both outputs.
I'd like to avoid using a temporary file if possible. Any clue?