I am using a python script that outputs many warnings/errors (going to stderr) based on perfectly normal bad test certificates. Based on several SO posts, I was able find a way to run the script and ignore select stdout, stderr lines but its cumbersome:
runThing 3>&1 1>&2 2>&3 3>&- | grep -r 's/Insecure/'
OR
runThing 3>&1 1>&2 2>&3 3>&- | sed 's/Insecure/g'
Both filter out lots of lines like:
/Users/xxx/.blah/lib/python2.7/site- packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html InsecureRequestWarning)
The sed one has this error, though: sed: 1: "s/Insecure/g": unterminated substitute in regular expression
Its a lot to add at the end of a line that is used a lot (the real runThing has commands and parameters), so I am trying to make a command like:
runThingClean() { command runThing "$@" > /dev/null 3>&1 1>&2 2>&3 3>&- | sed 's/Insecure/g' & }
When I run this, it now fails to filter (and shows the error is sed is used):
sed: 1: "s/Insecure/g": unterminated substitute in regular expression
Can someone help me fix this command?
Thanks in advance..