Re: [OFF-TOPIC] less with built-in grep ?
In debian-user,
Remco Blaakmeer <remco@Cal011205.student.utwente.nl> wrote:
>On 11 Mar 1998, Lorens Kockum wrote:
>> In effect, I want to put an egrep filter in less, with a regexp that could
>> be modified without restarting less or re-reading file.
>>
>> I think I'll be forwarding this to markn, less author. Should be rather
>> simple, and ... is there anyone else that thinks it might be useful ?
The discussion has been forwarded, I am awaiting a reply.
>You could, of course, use something like this:
>tail -f logfile | grep regexp | less
>or even something like:
>tail -f logfile | grep regexp > /dev/tty10
>Wouldn't that be sufficient? Only thing with grep (and some other
>utilities) is, if stdout is not a tty it will use a buffer for stdout. The
>first example probably won't work good enough for you.
It doesn't work, I've tried.
>But how about the second? 'grep' will keep working as long as 'tail' doesn't
>close the pipe, which it won't until it exits.
Yup, that works. No need for the > tty, though.
In fact I though of that a few months ago, but I forgot about it because
at the time it was absolutely necessary for me to get context when I wished.
For my present problem, this will be good :-) Thank you !
By the way, does anyone know of a way to force grep not to buffer
output? Some sort of shell environment variable, I suppose, at least
man grep offers no hint. That way I could pipe it to xargs and get
a beep every time there's a new line :-)
--
E-mail the word "unsubscribe" to debian-user-request@lists.debian.org
TO UNSUBSCRIBE FROM THIS MAILING LIST. Trouble? E-mail to listmaster@debian.org
Reply to: