Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: unix question: KSH pipes

RE: unix question: KSH pipes

From: Chuck Hamilton <chuck_hamilton_at_yahoo.com>
Date: Fri, 9 Jun 2000 09:36:36 -0700 (PDT)
Message-Id: <10523.108437@fatcity.com>


--0-424238335-960568596=:3781
Content-Type: text/plain; charset=us-ascii

 Why shouldn't it work? I thought that when commands are enclosed in ()'s they're supposed to be treated as a single command, with stdin of all the enclosed commands redirected from the same stream - the output of the previous command. What appears to be happening in my case is that the tail command doesn't pick up anything from the i/o buffer that's already been read by the head command. If the input stream is large enough, it works. When it's small (and contained in one buffer) it doesn't.

For the mean time I've changed it to...

X=`sar -w` ; echo "$X" | head -n 4; echo "$X" | tail  

Steve Adams wrote:

Hi Chuck,

The two that work shouldn't. I suggest you split the output to a temporary file using tee, and use that file as the input to the tail command.

Regards,
Steve Adams

http://www.ixora.com.au/
http://www.oreilly.com/catalog/orinternals/
http://www.christianity.net.au/


-----Original Message-----
From: Chuck Hamilton [SMTP:chuck_hamilton_at_yahoo.com] Sent: Friday, June 09, 2000 3:03 AM
To: Multiple recipients of list ORACLE-L Subject: unix question: KSH pipes

I have three SGI servers running the exact same version of IRIX (6.5.5 64 bit). I have a pipeline that works fine on two of them but not on the third. Here's the pipeline...

sar -w | (head -n 4 ; tail)

It prints the first 4 lines followed by the last 10 lines of the sar output on two machines. On the third it just prints the first 4 lines. Does anyone have any idea why? Is there an environment variable or set command I need to execute to make it work as it does on the other 2 machines?



Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints! << File: ATT00067.htm >>

Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
--0-424238335-960568596=:3781
Content-Type: text/html; charset=us-ascii

<P> Why shouldn't it work? I thought that when commands are enclosed in ()'s they're supposed to be treated as a single command, with stdin of all the enclosed commands redirected&nbsp;from the same stream - the output of the previous command. What appears to be happening in my case is that the tail command doesn't pick up anything from the i/o buffer that's already been read by the head command. If the input stream is large enough, it works. When it's small (and contained in one buffer) it doesn't.</P>
<P>For the mean time I've changed it to...</P>
<P>X=`sar -w` ; echo "$X" | head -n 4; echo "$X" | tail<BR></P>
<P> <BR><B><I>Steve Adams <STEVE.ADAMS_at_IXORA.COM.AU></I></B>wrote: <BR>
<BLOCKQUOTE style="BORDER-LEFT: #1010ff 2px solid; MARGIN-LEFT: 5px; PADDING-LEFT: 5px"><BR>Hi Chuck,<BR><BR>The two that work shouldn't. I suggest you split the output to a temporary <BR>file using tee, and use that file as the input to the tail command.<BR><BR>Regards,<BR>Steve Adams<BR>http://www.ixora.com.au/<BR>http://www.oreilly.com/catalog/orinternals/<BR>http://www.christianity.net.au/<BR><BR><BR>-----Original Message-----<BR>From: Chuck Hamilton [SMTP:chuck_hamilton@yahoo.com]<BR>Sent: Friday, June 09, 2000 3:03 AM<BR>To: Multiple recipients of list ORACLE-L<BR>Subject: unix question: KSH pipes<BR><BR><BR>I have three SGI servers running the exact same version of IRIX (6.5.5 64 <BR>bit). I have a pipeline that works fine on two of them but not on the <BR>third. Here's the pipeline...<BR><BR>sar -w | (head -n 4 ; tail)<BR><BR>It prints the first 4 lines followed by the last 10 lines of the sar output <BR>on two machines. On the third it just prints the first 4 lines. D!

oes anyone <BR>have any idea why? Is there an environment variable or set command I need <BR>to execute to make it work as it does on the other 2 machines?<BR><BR><BR><BR><BR><BR>---------------------------------<BR>Do You Yahoo!?<BR>Yahoo! Photos -- now, 100 FREE prints! &lt;&lt; File: ATT00067.htm &gt;&gt; <BR></BLOCKQUOTE><BR><p><br><hr size=1><b>Do You Yahoo!?</b><br>

<a href="http://photos.yahoo.com/">Yahoo! Photos</a> -- now, 100 FREE prints!
Received on Fri Jun 09 2000 - 11:36:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US