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?
--
Barry Margolin, bar...@genuity.net
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.
If you have a suggestion, I would appreciate the help.
Barry Margolin <bar...@bbnplanet.com> wrote in message
news:fr1K4.7$Mv3.355@burlma1-snr2...
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.
vmstat -w 5 | awk '/^\ [0-9]/ {print | "logger -p local0.info" }'
Barry Margolin <bar...@bbnplanet.com> wrote in message
news:aZ1K4.14$Mv3.87@burlma1-snr2...
> 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
How does that solve the sed buffering problem?
>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).