[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Possible bug with grep/sed/tail?
From: |
Pádraig Brady |
Subject: |
Re: Possible bug with grep/sed/tail? |
Date: |
Sat, 22 Nov 2008 13:57:55 +0000 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Jim Meyering wrote:
> 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:
grep --color 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:
>
That's a tip and a half.
I'll certainly be using that,
Though I'll probably auto-compile the lib like:
[ ! -x "$line_buffer_so" ] && line-buffer-init()
Of course this solution depends on gcc and LD_PRELOAD etc.
What about adding buffer control to all coretuils filters.
Is that still a desired feature do you think?
cheers,
Pádraig.
- Re: Possible bug with grep/sed/tail?, (continued)
- Re: Possible bug with grep/sed/tail?, Brian Dessent, 2008/11/20
- 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, 2008/11/22
- Re: Possible bug with grep/sed/tail?,
Pádraig Brady <=
- 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
- Re: Possible bug with grep/sed/tail?, Jim Meyering, 2008/11/25