LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Is there a way to print output data from within a pipeline ? (https://www.linuxquestions.org/questions/linux-newbie-8/is-there-a-way-to-print-output-data-from-within-a-pipeline-4175564249/)

anindyameister 01-18-2016 05:40 AM

Is there a way to print output data from within a pipeline ?
 
So I am running a command with fairly large output and piped it into various combination of grep and awks to extract specific data and assigning it to a variable by running the whole chain in substitution or backtick, all in one line. My question is, is there a way to view the full output of the first element of the pipeline without disturbing the downstream ? I've thought about teeing to a file but it seems a bit cumbersome. I just want to know if there's a lightweight and elegant solution to this. Thanks in advance.

anindyameister 01-18-2016 05:59 AM

ok, so i've found out a workaround that I should find the tty and tee into that so the pipeline can run as well as I can see the full output. Don't know if this is a acceptable fix. Please let me know.

rknichols 01-18-2016 12:39 PM

It's pretty straightforward as long as the volume of output isn't something ridiculous to be sending to the tty:
Code:

some_command | tee /dev/tty | rest_of_pipeline


All times are GMT -5. The time now is 09:43 AM.