cmd= ["sudo", "cat", "{filepath}".format(filepath=filepath), "|","egrep", "-v","\'{filteruser}\'".format(filteruser=filteruser)]
fileformat and filteruser can be blank too
config file below
[plugin_haproxy]
user= tara
host=localhost
filepath=/etc/haproxy/haproxy.global.inc
filter=
This is the command I want to run on subprocess, checking the above variable values with pdb shows bellow value and looks great
['sudo', 'cat', '/etc/haproxy/haproxy.global.inc', '|', 'egrep', '-v', "''"]
Manullay running the code sudo cat /etc/haproxy/haproxy.global.inc | egrep -v " '' " on terminal works great
Why is subprocess not able to process it.
"cat: |: No such file or directory\ncat: egrep: No such file or directory\ncat: