I have a command which runs a python script that has some prints and also returns a result to stdout. My question is how can I run this script and pipe the result to next command, without piping the prints.
For example, if my python script is like this,
def my_python_script_logic:
print("script started")
print("script keeps running")
print("script finishes soon")
sys.stdout.write("script result")
When running this in terminal,
my_python_script_command | xargs -I {} the_next_command {}
how to avoid piping the string that got printed to the next command, and only pipe the "script result"?
p.s. Not necessary to use xargs. It's just something I tried.
p.s. One interesting found, if I run this,
my_python_script_command | xargs -I {} echo {}
the echo only display the "script result".
Thus I tried this,
my_python_script_command | xargs -I {} echo {} | xargs -I {} the_next_command {}
but still not working