I have set a variable strFileExt to a file path/name: /var/log/error.log.112119
I would now like to grep that file, capturing output to a second variable. If there is no output (text does not exist) I will exit. If it does return output, I will then move on to perform other things with this file.
I have tried many variations of the following to no success:
Thanks in advance.
I would now like to grep that file, capturing output to a second variable. If there is no output (text does not exist) I will exit. If it does return output, I will then move on to perform other things with this file.
I have tried many variations of the following to no success:
strFile = os.popen('grep -rlw "reported errors in the" + strFileExt+').read()Is there a way to set this strFile variable using the grep command which includes the first set variable of strFileExt ?
Thanks in advance.