Hello,
I want to grep the error's out of a log file and save the value as an error. When I use:
errors = os.system("cat log.txt | grep 'ERROR' | wc -l")
I get the return code that the command worked or not. When I use:
errors = os.popen("cat log.txt | grep 'ERROR' | wc -l")
I get what the command is trying to do.
When I run this in the command line I get 3 as thats how many errors there are.
Can anyone suggest another way in Python that will allow me to save the value of this bash command?
Thanks