[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: weird bash pipe behavior
From: |
Greg Wooledge |
Subject: |
Re: weird bash pipe behavior |
Date: |
Thu, 21 Jan 2010 08:18:59 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Wed, Jan 20, 2010 at 07:34:35AM -0800, CptDpondo wrote:
> mencoder .... 2>&1 | tr '\r' '\n' | grep -v -B 1 '^Pos'
>
> this eventually creates the correct output, but it's buffered until
> mencoder completes. I have no idea why; the tr command streams
> without buffering and I've used grep for years and never run into this
> behavior.
grep definitely has this buffering behavior. If you're using GNU grep,
you can give it the --line-buffered option to change this, at least
according to whichever contributor added that one to
http://mywiki.wooledge.org/BashFAQ/009