I want to remove the error from the log file and save the value as an error. When i use:
errors = os.system("cat log.txt | grep 'ERROR' | wc -l")
I get a return code that the team worked or not. When i use:
errors = os.popen("cat log.txt | grep 'ERROR' | wc -l")
I get what the command is trying to execute.
When I run this on the command line, I get 3 because this is the number of errors.
Can anyone suggest another way in Python that will allow me to save the value of this bash command?
thank
source
share