vmstat | sed WORKS vmstat | logger WORKS vmstat | sed | logger FAILS

vmstat | sed WORKS vmstat | logger WORKS vmstat | sed | logger FAILS

Post by jabe_on » Sun, 16 Apr 2000 04:00:00



I am using FreeBSD 3.3.  The following two pipes work fine:

vmstat -w 5 | logger -p local0.info
vmstat -w 5 | sed -e /procs/d -e /fre/d

But don't work when combined into:

vmstat -w 5 | sed -e /procs/d -e /fre/d | logger -p local0.info

I don't understand why.  Any suggestions?

 
 
 

vmstat | sed WORKS vmstat | logger WORKS vmstat | sed | logger FAILS

Post by Barry Margoli » Sun, 16 Apr 2000 04:00:00




>I am using FreeBSD 3.3.  The following two pipes work fine:

>vmstat -w 5 | logger -p local0.info
>vmstat -w 5 | sed -e /procs/d -e /fre/d

>But don't work when combined into:

>vmstat -w 5 | sed -e /procs/d -e /fre/d | logger -p local0.info

>I don't understand why.  Any suggestions?

Sed probably uses stdio, which buffers output when writing to a non-tty.

I'm pretty sure I answered an almost identical question a few days ago in
one of the comp.unix.* newsgroups.  Was that you?

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

vmstat | sed WORKS vmstat | logger WORKS vmstat | sed | logger FAILS

Post by jabe_on » Sun, 16 Apr 2000 04:00:00


Yes.  I posted a message last Saturday or Sunday and received one reply
recommending to omit the vmstat part.  Because vmstat is the source of the
data stream, that didn't make sense to me.  I was unable to check any
messages after Sunday and did not find the original or any responses today.

If you have a suggestion, I would appreciate the help.




> >I am using FreeBSD 3.3.  The following two pipes work fine:

> >vmstat -w 5 | logger -p local0.info
> >vmstat -w 5 | sed -e /procs/d -e /fre/d

> >But don't work when combined into:

> >vmstat -w 5 | sed -e /procs/d -e /fre/d | logger -p local0.info

> >I don't understand why.  Any suggestions?

> Sed probably uses stdio, which buffers output when writing to a non-tty.

> I'm pretty sure I answered an almost identical question a few days ago in
> one of the comp.unix.* newsgroups.  Was that you?

> --

> Genuity, Burlington, MA
> *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to
newsgroups.
> Please DON'T copy followups to me -- I'll assume it wasn't posted to the

group.
 
 
 

vmstat | sed WORKS vmstat | logger WORKS vmstat | sed | logger FAILS

Post by Barry Margoli » Sun, 16 Apr 2000 04:00:00




>Yes.  I posted a message last Saturday or Sunday and received one reply
>recommending to omit the vmstat part.  Because vmstat is the source of the
>data stream, that didn't make sense to me.  I was unable to check any
>messages after Sunday and did not find the original or any responses today.

The message I responded to was from you, but it didn't have logger; it had

vmstat | sed | sed

I told you to use a single sed with multiple -e options, which is what
you've done.

The problem that was affecting the second sed is now affecting logger -- it
doesn't get anything until sed's output buffer fills up.  The only way to
fix it is to make sed's output go to a tty.  I think Expect includes a
simple utility to do this.

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

vmstat | sed WORKS vmstat | logger WORKS vmstat | sed | logger FAILS

Post by jabe_on » Sun, 16 Apr 2000 04:00:00


Yes, thanks for the help with sed.  By the way, I did get an answer to the
current question that seems to be working fine:

vmstat -w 5 | awk '/^\ [0-9]/ {print | "logger -p local0.info" }'




> >Yes.  I posted a message last Saturday or Sunday and received one reply
> >recommending to omit the vmstat part.  Because vmstat is the source of
the
> >data stream, that didn't make sense to me.  I was unable to check any
> >messages after Sunday and did not find the original or any responses
today.

> The message I responded to was from you, but it didn't have logger; it had

> vmstat | sed | sed

> I told you to use a single sed with multiple -e options, which is what
> you've done.

> The problem that was affecting the second sed is now affecting logger --
it
> doesn't get anything until sed's output buffer fills up.  The only way to
> fix it is to make sed's output go to a tty.  I think Expect includes a
> simple utility to do this.

> --

> Genuity, Burlington, MA
> *** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to
newsgroups.
> Please DON'T copy followups to me -- I'll assume it wasn't posted to the

group.
 
 
 

vmstat | sed WORKS vmstat | logger WORKS vmstat | sed | logger FAILS

Post by Rob Kouwenbe » Sun, 16 Apr 2000 04:00:00



> I am using FreeBSD 3.3.  The following two pipes work fine:

> vmstat -w 5 | logger -p local0.info
> vmstat -w 5 | sed -e /procs/d -e /fre/d

> But don't work when combined into:

> vmstat -w 5 | sed -e /procs/d -e /fre/d | logger -p local0.info

> I don't understand why.  Any suggestions?

vmstat -w 5 | sed -e '/procs/d; /fre/d' | logger -p local0.info
vmstat -w 5 | grep -v 'procs|fre' | logger -p local0.info
 
 
 

vmstat | sed WORKS vmstat | logger WORKS vmstat | sed | logger FAILS

Post by Barry Margoli » Mon, 17 Apr 2000 04:00:00




>vmstat -w 5 | sed -e '/procs/d; /fre/d' | logger -p local0.info

How does that solve the sed buffering problem?

Quote:>vmstat -w 5 | grep -v 'procs|fre' | logger -p local0.info

grep also buffers its output, so this is no solution, either.  BTW, I think
you meant "egrep".

It seems like you have no idea what the problem is, and you're just making
random modifications to the OP's command line, without even testing them
(if you don't want to log messages, just replace the logger command with
"cat" and you'll see the problem).

--

Genuity, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

1. vmstat | sed WORKS vmstat | logger WORKS vmstat | sed | logger FAILS - NEED HELP

I am using FreeBSD 3.3.

The following two pipes work fine:

vmstat -w 5 | logger -p local0.info
vmstat -w 5 | sed -e /procs/d -e /fre/d

But don't work when combined into:

vmstat -w 5 | sed -e /procs/d -e /fre/d | logger -p local0.info

I don't understand why.  Any suggestions?

2. [ATM] cleanup nicstar, suni and idt77105

3. vmstat doesn't work when y2k fix applied on 4.3.1

4. Virtual Window Size

5. vmstat can't work in 4.3.3

6. Canon BubbleJet i950

7. Q)vmstat doesn't work.

8. Mounting SMB units on Solaris

9. How does vmstat work?

10. vmstat: 0551-129 knlist failed

11. vmstat fail

12. vmstat failed

13. sed sed sed