I have a long list of symbolic links to python venvs that I would like to run the –version flag on. Some of the links are broken and some of the Python binaries require other versions of glibc than what is on the machine so that will print a multi-line error. My goal is to have the output of xargs, no matter how many lines of stdout or stderr, print a single line per symbolic link, so the output line count matches the input line count.
I’ve tried just the basic
... | xargs -I {} sh -c "{} --version" 2>&1 | tee output.txt
but it will print multiple lines for multi-line errors, so the resulting line count doesn’t match the input line count.
OldManWaterfall is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.