how to get output of grep command (Python)
<p>I have an input file test.txt as:
host:dc2000
host:192.168.178.2</p>

<p>I want to get all of addresses of those machines by using:</p>

<pre><code>grep "host:" /root/test.txt 
</code></pre>

<p>And so on, i get command ouput via python:</p>

<pre><code>import subprocess
file_input='/root/test.txt'
hosts=subprocess.Popen(['grep','"host:"',file_input], stdout= subprocess.PIPE)
print hosts.stdout.read()
</code></pre>

<p>But the result is empty string.</p>

<p>I don't know what problem i got. Can you suggest me how to solve ?</p>
