Sponsored Content
Operating Systems Solaris Question about pipes in solaris (and others) and buffering.... Post 40012 by sannik on Sunday 7th of September 2003 02:42:31 AM
Old 09-07-2003
Question about pipes in solaris (and others) and buffering....

This is weird, so I'm hoping someone here knows solaris and how it handles pipes...

OK... here goes...

Theres this log file, right? I want to tail -f it, grep that, gzip that, then pipe that into more commands. Well thats easy, right?

tail -f file | grep pattern | gzip | otherstuff...

Except...

The output of grep is buffered... Not linebuffered, but 5120 character buffered. As in:

tail -f file | grep pattern | cat

Buffers, and only put stuff to the terminal after grep has outputted 5191 characters.

tail -f file | grep pattern
and
tail -f file | cat

do not.

Using perl, or sed, or tr, or awk, or gzip, or a number of others instead of grep exhibit this behavior as well. It was suggested to me that this might have to do with solaris' bidirectional pipes. I'm not sure that this means.

The buffering doesn't work for me, because with the grep, and further with the gzip, it could take the thing a week to fill once in real use, which isn't really workable for what I need to do.

On another machine, also running solaris, the same thing occurs, except in blocks of 4096. Same on a linux machine.

The question... Is there any way to make a pipe not exhibit this behavior? It is undesirable for my use.

Last edited by sannik; 09-07-2003 at 04:08 AM..
 

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

Windows Buffering during playing

Hello! Will someone out there pls help in clearifying what is really wrong with my system. I use window 98 as my operating system. I am connected to a proxy server for browsing the net. Whenever l am listening to music online l have the problem of intermitted break in which the playing will... (10 Replies)
Discussion started by: kayode
10 Replies

2. Filesystems, Disks and Memory

PIPEs and Named PIPEs (FIFO) Buffer size

Hello! How I can increase or decrease predefined pipe buffer size? System FreeBSD 4.9 and RedHat Linux 9.0 Thanks! (1 Reply)
Discussion started by: Jus
1 Replies

3. UNIX for Advanced & Expert Users

Question on forks and pipes

I am trying to figure out why when i have the following code int main( { printf("0\n"); fork(); printf("1\n"); exit(0);} and type in the shell a.out | cat the output of this program is 0 1 0 1 instead of 0 1 1 does anyone know? (3 Replies)
Discussion started by: Phantom12345
3 Replies

4. Shell Programming and Scripting

Tcl: Outputting Unix console without Buffering

Hi, I'm have a tcl application using expect. The application is connecting to a unix box and is running a script. What i need my app to do is show the output of the console as the script runs in realtime. At the moment, it my app is waiting until the script finishes and then dumps what is... (0 Replies)
Discussion started by: Phi01
0 Replies

5. Solaris

A Solaris Question

hi.. I have a question because there are files on Solaris and will not let me change the root user is the owner. excuse is that I come from a Linux environment and I like to learn Solaris thank (5 Replies)
Discussion started by: cejodrake
5 Replies

6. UNIX for Advanced & Expert Users

Discussion on buffering of standard I/O library

Hi, There are three type of buffering: Fully buffered,line buffered,and unbuffered. The goal of the buffering provided by the standard I/O library is to use the minimum number of read and write calls. I understand that decrease write() calls when use output function output data to a file ,... (4 Replies)
Discussion started by: Edward114
4 Replies

7. Programming

Question on pipes in C

If a code forks 2 childs, what can the values be for the process id's of each of the child? I child pid is supposed to be 0, but what if you fork 2 of them? (5 Replies)
Discussion started by: omega666
5 Replies

8. Shell Programming and Scripting

Perl open(CMD, "cmd |"); buffering problem..

Hello, There's a third-party application's command that shows the application's status like "tail -f verybusy.log". When use the command, the output comes every 1-sec. but when it goes in a script below the output comes every 8-sec...What is the problem and how can I fix it? open(CMD,... (2 Replies)
Discussion started by: Shawn, Lee
2 Replies

9. Solaris

Question with Solaris Crash Analysis Tool with Solaris 9

Hello all. I am new hear and would like to ask a question regarding to the Solaris Crash Analysis Tool. We are analyzing the results of "thread summary" but not quite sure what the asterisk represents. Following are the items that asterisk were attached. 50* threads sleeping on a semaphore (49... (1 Reply)
Discussion started by: YuW
1 Replies

10. Shell Programming and Scripting

Getting piped input from a program that's buffering it's stdout

The old buffering problem again, in a very specific case. On FreeBSD this time, but it's the generic line-buffered vs fully-buffered problem. I'm trying to pick an available bluetooth speaker (all named audio_N), by pinging all of them en mass and taking the first to respond. The... (10 Replies)
Discussion started by: Juha Nurmela
10 Replies
XZGREP(1)							     XZ Utils								 XZGREP(1)

NAME
xzgrep - search compressed files for a regular expression SYNOPSIS
xzgrep [grep_options] [-e] pattern file... xzegrep ... xzfgrep ... lzgrep ... lzegrep ... lzfgrep ... DESCRIPTION
xzgrep invokes grep(1) on files which may be either uncompressed or compressed with xz(1), lzma(1), gzip(1), bzip2(1), or lzop(1). All options specified are passed directly to grep(1). If no file is specified, then standard input is decompressed if necessary and fed to grep(1). When reading from standard input, gzip(1), bzip2(1), and lzop(1) compressed files are not supported. If xzgrep is invoked as xzegrep or xzfgrep then egrep(1) or fgrep(1) is used instead of grep(1). The same applies to names lzgrep, lze- grep, and lzfgrep, which are provided for backward compatibility with LZMA Utils. ENVIRONMENT
GREP If the GREP environment variable is set, xzgrep uses it instead of grep(1), egrep(1), or fgrep(1). SEE ALSO
grep(1), xz(1), gzip(1), bzip2(1), lzop(1), zgrep(1) Tukaani 2011-03-19 XZGREP(1)
All times are GMT -4. The time now is 11:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy