Assuming that you are using a shell that supports process substitutions with >(...)
, then you could use tee
to redirect into the txt2html
command for you:
nmap localhost | tee >(txt2html -extract -8 >>some-file)
Here, txt2html
gets its input from tee
and appends its output to some-file
.
Apart from writing to txt2html
, tee
would also write its original input to the standard output stream, which presumably would be connected to the terminal.
In this scenario, any diagnostic output from nmap
would bypass both tee
and txt2html
and be sent directly to the terminal. If you instead want to process this, redirect the output of the command on the left-hand side of the pipeline with 2>&1
so that its standard error stream is redirected along with the standard output stream.