I want to do the following,
         command2(stdout)
        /                \
command1                  command4
        \                /
         command3(stderr)
As it is covered in How can I split and re-join STDOUT from multiple processes?
Except, command1 outputs different text to both, stdout and stderr. So, it is a combination of the above question and Pipe stderr to another command
To have a context, what I am trying to achieve:
- Execute curl
- Capture raw output (stdout), base64, and embed it into json: curl https://someaddress.tld | base64 | jq --raw-input '{"curl_ret" : .}'
- Output curl json (return code etc) and pass it to stderr: curl --write-out '%{stderr}%{json}' https://someaddress.tld
- Given #2 and #3 is the same curl call, I want to merge the output of #2 and #3 and pass the merged result to jq: jq --slurp ...
All these in one piped command.
stdout and stderr separation is done to avoid parsing merged text, to avoid pitfalls, given curl output can be anything. Curl has --silent switch so no unexpected text in either output stream
 
    