Limit on number of pipes after long-running command?


Login or Register to Reply

 
Thread Tools Search this Thread
# 8  
No, that's not the issue: xinput test 6 definitely outputs to stdout. Proof is that xinput test 6 6>/dev/null produces output, but xinput test 6 1>/dev/null produces no output.

As I tried to explain, 6 in the command is an argument to xinput that tells it the input device I'm interested in testing. It is not a file descriptor.

Last edited by DevuanFan; 5 Days Ago at 11:31 AM..
# 9  
Might be due to buffering. Try as a zeroth approximation
Code:
xinput test 6 | awk -Winteractive '{print $3}'

This User Gave Thanks to RudiC For This Post:
# 10  
Both gawk and nawk complain: option `-W interactive` unrecognized, ignored.

But I think we're getting warmer. It does seem to have something to do with buffering.
# 11  
Quote:
Originally Posted by DevuanFan
Both gawk and nawk complain: option `-W interactive` unrecognized, ignored.

But I think we're getting warmer. It does seem to have something to do with buffering.
how about:
Code:
xinput test 6 | gawk '{print $3;fflush()}' | grep whatEver

# 12  
YES! That works. Is there a way to generalize this solution (e.g., at the level of the shell), so that things keep flowing down the pipe?

--- Post updated at 04:09 PM ---

Thank you, RudiC and vgersh99. It was a buffering issue. I found this helpful thread:
shell - Turn off buffering in pipe - Unix & Linux Stack Exchange

I can confirm that either of these pipelines work as expected:
Code:
stdbuf -o0 xinput test 9 | stdbuf -o0 grep release | awk '{print $3}'

Code:
unbuffer xinput test 9 | unbuffer -p grep release | awk '{print $3}'

This User Gave Thanks to DevuanFan For This Post:
# 13  
Quote:
Originally Posted by DevuanFan
YES! That works. Is there a way to generalize this solution (e.g., at the level of the shell), so that things keep flowing down the pipe?

--- Post updated at 04:09 PM ---

Thank you, RudiC and vgersh99. It was a buffering issue. I found this helpful thread:
shell - Turn off buffering in pipe - Unix & Linux Stack Exchange

I can confirm that either of these pipelines work as expected:
Code:
stdbuf -o0 xinput test 9 | stdbuf -o0 grep release | awk '{print $3}'

Code:
unbuffer xinput test 9 | unbuffer -p grep release | awk '{print $3}'

That's exactly the same thread I found Googling: Turn off buffering in pipe.
It's a combo of stdbuf/unbuffer/cat/script - multiple suggestions.
# 14  
Actually, for some reason it is not necessary to turn off buffering in the first command. Only in the second. In other words, these versions also work:

Code:
xinput test 9 | stdbuf -o0 grep release | awk '{print $3}'

Code:
xinput test 9 | unbuffer -p grep release | awk '{print $3}'

Guess I need to read up on buffering, since I'm stoked that we found a fix but don't fully understand why we don't have to unbuffer the first command.
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
How to put a 80 character limit on a long topic line in markdown?
dragonpoint
I have a topic line in markdown that spans more than 80 characters that i need to add a line break. Markdown is simply treating the line break as a brand new line instead of continuing as a topic line. Eg: # This is a very long line Markdown interprets it as This is a very long line... UNIX for Beginners Questions & Answers
4
UNIX for Beginners Questions & Answers
Limit process number in TOP command outupt
vikram3.r
Linux top command prints more than 40 processes. top -b -n 1 > Top_Output.txt Is there a straight-forward option/way to limit only till the top 5 processes. ( Instead of using head, tail or other unix commands together)... UNIX for Dummies Questions & Answers
1
UNIX for Dummies Questions & Answers
Limit on Number of Cron Jobs Running on one Account
Pramodini Rode
Hello, I have some 150 Cron Jobs running under my UNIX account. I want to add some more jobs. Is there a limit to the number of cron jobs that can be run on an account? Thank you. Pramodini... UNIX for Advanced & Expert Users
8
UNIX for Advanced & Expert Users
Number of long limit
herath
Hi Hi! I'm currently using AIX 5.2 and would like to know where can i find to see that there's a restriction on the number of login times a user can have. Example, I want give a 2 login per user but some one to give 3 login and some one have to give unlit login time (without logging off the...... UNIX for Dummies Questions & Answers
2
UNIX for Dummies Questions & Answers
How to limit the number of running instances of a script?
oti
I would like to allow only one instance of a script to run at any moment. I've tried the following solution to count the instances but the result is always the number of running instances plus one and I can't find the problem ps -ef | grep $0 | sed '/^$/ d' | sed '/grep/ d' | wc -l Please...... Shell Programming and Scripting
2
Shell Programming and Scripting