Hi all professionals,
I uesd subprocess module to spawn a new process and then implement the command. The final result is the output via stdout.
Here is the code I wrote:
import subprocess
proc = subprocess.Popen('egrep \'^HTTP/\' *', shell=True, stdout=subprocess.PIPE,)
stdout_value = proc.communicate()[0]
print 'results:'
print stdout_value
And the results are:
063.245.209.093.00080-128.192.076.180.01039:HTTP/1.1 302 Found
063.245.209.093.00080-128.192.076.180.01040:HTTP/1.1 302 Found
My question is: How to convert/record these results into a file?
I appreciate all your responses and helps!