Search code examples
pythonhttp-redirectterminalpiping

Using Python in a Linux Terminal


Okay, so, I just have a quick question regarding python and linux.

I have a program that collects and outputs data to stdout indefinitely. I need to parse this data, and I have a python program I wrote that will do just that. However, I cannot save this data to a file first, as it produces far too much output to save to disk. Is there any way to use redirects to somehow pipe this output into the program?

Example:

python parser.py < ./dataCollector.sh

Solution

  • Close, but you want an actual pipe not a shell redirect:

    ./dataCollector.sh | python parser.py