[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible bug with grep/sed/tail?
From: |
Jim Meyering |
Subject: |
Re: Possible bug with grep/sed/tail? |
Date: |
Sat, 22 Nov 2008 13:17:18 +0100 |
Jim Meyering <address@hidden> wrote:
> Andreas Schwab <address@hidden> wrote:
>> Paolo Bonzini <address@hidden> writes:
>>
>>> alias line-buffer='preload /t/linebuf.so'
>>
>> If you end the alias expansion with a space then the next word is also
>> expanded as an alias.
>
> Ah, yes. That was it. Thanks ;-)
To summarize, here's what I'm using, now:
Put the following in your .bashrc or .zshrc file:
# Create the .so file with the following.
line_buffer_so=$HOME/lib/line-buffer.so
line-buffer-init()
{
echo '__attribute__((constructor))void f(){setvbuf(stdout,NULL,_IOLBF,0);}'
\
| gcc -s -include stdio.h -x c - -fPIC -shared -o "$line_buffer_so"
}
alias line-buffer="LD_PRELOAD='$line_buffer_so' "
As a one-time set-up, you have to run the line-buffer-init function.
Then you can use it e.g., to watch *interactively* filtered tail -f output.
For example, watch for warnings in build output like this:
make >& log & line-buffer tail -F log | grep warning:
but that's not quite right, since it hangs forever.
Add --pid=$! to make tail stop when the parent (make) process dies:
make >& log & line-buffer tail -F log --pid=$! | grep warning:
- Re: Possible bug with grep/sed/tail?, (continued)
- Re: Possible bug with grep/sed/tail?, Pádraig Brady, 2008/11/20
- Re: Possible bug with grep/sed/tail?, Brian Dessent, 2008/11/21
- Re: Possible bug with grep/sed/tail?, Jim Meyering, 2008/11/21
- Re: Possible bug with grep/sed/tail?, Reuben Thomas, 2008/11/21
- Re: Possible bug with grep/sed/tail?, Paolo Bonzini, 2008/11/21
- Re: Possible bug with grep/sed/tail?, Andreas Schwab, 2008/11/21
- Re: Possible bug with grep/sed/tail?, Jim Meyering, 2008/11/21
- Re: Possible bug with grep/sed/tail?,
Jim Meyering <=
- Re: Possible bug with grep/sed/tail?, Pádraig Brady, 2008/11/22
- Re: Possible bug with grep/sed/tail?, Jim Meyering, 2008/11/22
- Re: Possible bug with grep/sed/tail?, Brian Dessent, 2008/11/22
- Re: Possible bug with grep/sed/tail?, Jim Meyering, 2008/11/29
- Re: Possible bug with grep/sed/tail?, Pádraig Brady, 2008/11/30
- Re: Possible bug with grep/sed/tail?, Pádraig Brady, 2008/11/24
- Re: Possible bug with grep/sed/tail?, Jim Meyering, 2008/11/24
- Re: Possible bug with grep/sed/tail?, Pádraig Brady, 2008/11/25
- Re: Possible bug with grep/sed/tail?, Jim Meyering, 2008/11/25
- Re: Possible bug with grep/sed/tail?, Paolo Bonzini, 2008/11/25