I'm trying to grep from a directory and limit the search to the first 100 results. The following code keeps yielding
[..]
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
grep: writing output: Broken pipe
[..]
The code:
p_grep = Popen(['/bin/bash', '-c', 'grep -F "asdasdasd" data/*'], stdout = PIPE)
p_head = Popen(['head', '-100'], stdin = p_grep.stdout, stdout = PIPE)
output = p_head.communicate()[0]
How to fix it?