I'm trying to use the call method within python, how do I pipe something in (l | grep c++)
?
Asked
Active
Viewed 247 times
2

OneCricketeer
- 179,855
- 19
- 132
- 245

Thomas Smith
- 23
- 1
- 6
-
The `call` in `subprocess`? Can you post some code? – kindall Feb 14 '16 at 06:18
-
What is the binary `l`? – OneCricketeer Feb 14 '16 at 06:21
-
@cricket_007 A commonly used bash alias for ls -al – Thomas Smith Feb 14 '16 at 06:54
-
`#!usr/bin/env python from subprocess import call call(["ls"]) ` – Thomas Smith Feb 14 '16 at 06:55
1 Answers
3
Based on Python subprocess command with pipe
s = subprocess.Popen(["l"], stdout=subprocess.PIPE)
output = subprocess.check_output(("grep", "c++"), stdin=s.stdout)

Community
- 1
- 1

Nolen Royalty
- 18,415
- 4
- 40
- 50