KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an input file test.txt as: host:dc2000 host:192.168.178.2 I want to get all of addresses of those machines by using: grep "host:" /root/test.txt And so on, I get command ouput via python: import subprocess file_input='/root/test.txt' hosts=subprocess.Popen(['grep','"host:"',file_input], stdout= subprocess.PIPE) print hosts.stdout.read() But the result is empty string. I don't know what problem I got. Can you suggest me how to solve?
Tags (comma-separated)
Save Edits
Cancel