Sponsored Content
Top Forums Shell Programming and Scripting Limit on number of pipes after long-running command? Post 303035212 by vgersh99 on Thursday 16th of May 2019 12:13:48 PM
Old 05-16-2019
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.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to limit the number of running instances of a script?

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... (2 Replies)
Discussion started by: oti
2 Replies

2. UNIX for Dummies Questions & Answers

Number of long limit

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... (2 Replies)
Discussion started by: herath
2 Replies

3. Shell Programming and Scripting

Counting the number of pipes in line

Hi, I'm using the ksh shell. The scenario: I have a couple of directories /home/fd /home/fd/prsd home/fd/stg now i have number of files in each of these directories. some of the files are zipped using gzip so their extension is .gz the content of the files is as follows ... (4 Replies)
Discussion started by: nirnay_s
4 Replies

4. Solaris

How to limit number of Commands

Is there a way that I can limit number of commands that one user can run during period of time. For example Max 10 commands per senconds.:) (3 Replies)
Discussion started by: winger0608
3 Replies

5. UNIX for Advanced & Expert Users

Limit on Number of Cron Jobs Running on one Account

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 (8 Replies)
Discussion started by: Pramodini Rode
8 Replies

6. Shell Programming and Scripting

While loop running after reaching limit

Hi frnds i am newbie in linux and trying to write a simple script for adding users.the problem is i am running a while loop under function and loop is running for 3 time more than limit.Here is my Script and output pls help me out : # CREATE N NO. OF USERS WITH PASSWORD IN SYSTEM #... (4 Replies)
Discussion started by: Vaibhav.T
4 Replies

7. UNIX for Dummies Questions & Answers

Limit Number of files

hi guys how can i limit number of files in a disk or partition ? or how can i make a limit to inode number for a disk or partition ? ext3 or ext4 file system (1 Reply)
Discussion started by: mhs
1 Replies

8. UNIX for Dummies Questions & Answers

Limit process number in TOP command outupt

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) (1 Reply)
Discussion started by: vikram3.r
1 Replies

9. UNIX for Beginners Questions & Answers

How to put a 80 character limit on a long topic line in markdown?

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 (4 Replies)
Discussion started by: dragonpoint
4 Replies

10. UNIX for Beginners Questions & Answers

awk command input string too long, limit

cat filename| awk '{ $1=""; print $0}' in my file there are few lines that has more than 3000 characters per line and as soon as I run the above command it cores, strings core reveals that the awk is failing because input string too long, limit. can i get some help from the experts to find... (8 Replies)
Discussion started by: knijjar
8 Replies
STDBUF(1)							   User Commands							 STDBUF(1)

NAME
stdbuf - Run COMMAND, with modified buffering operations for its standard streams. SYNOPSIS
stdbuf OPTION... COMMAND DESCRIPTION
Run COMMAND, with modified buffering operations for its standard streams. Mandatory arguments to long options are mandatory for short options too. -i, --input=MODE adjust standard input stream buffering -o, --output=MODE adjust standard output stream buffering -e, --error=MODE adjust standard error stream buffering --help display this help and exit --version output version information and exit If MODE is 'L' the corresponding stream will be line buffered. This option is invalid with standard input. If MODE is '0' the corresponding stream will be unbuffered. Otherwise MODE is a number which may be followed by one of the following: KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y. In this case the corresponding stream will be fully buffered with the buffer size set to MODE bytes. NOTE: If COMMAND adjusts the buffering of its standard streams ('tee' does for e.g.) then that will override corresponding settings changed by 'stdbuf'. Also some filters (like 'dd' and 'cat' etc.) don't use streams for I/O, and are thus unaffected by 'stdbuf' settings. GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report stdbuf translation bugs to <http://translationproject.org/team/> EXAMPLES
tail -f access.log | stdbuf -oL cut -d ' ' -f1 | uniq This will immedidately display unique entries from access.log BUGS
On GLIBC platforms, specifying a buffer size, i.e. using fully buffered mode will result in undefined operation. AUTHOR
Written by Padraig Brady. COPYRIGHT
Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for stdbuf is maintained as a Texinfo manual. If the info and stdbuf programs are properly installed at your site, the command info coreutils 'stdbuf invocation' should give you access to the complete manual. GNU coreutils 8.22 June 2014 STDBUF(1)
All times are GMT -4. The time now is 07:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy