Re: [OFF-TOPIC] Re: Simple Unix utility?

1997-12-10 Thread Torsten Hilbrich
Lorens Kockum [EMAIL PROTECTED] writes:

 NONDEBIANPOST
 
 On Sun, Dec 07, 1997 at 12:31:23PM +0100, Torsten Hilbrich wrote:
  
  cut doesn't buffers everything, grep is to blame.  If grep output to a
  non-terminal (e.g. a pipe) it use buffers of 4k (don't remember the
  correct value).  Unfortunatly, I don't know any way to get around
  this.
 
 If that's the problem, then do 
 
   tail -f file | cut -b whatever | grep whatever
 
 and presto, you're outputting to a terminal.  Won't work, of course,
 if cut has the same problem.

Of course.  I assume that almost any utility block buffers the output
if not going to the terminal.  This will happen if you have more than
one pipe in your command line.

Torsten

-- 
I haven't lost my mind -- it's backed up on tape somewhere.
Fortune Cookie
PGP Public key available


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


[OFF-TOPIC] Re: Simple Unix utility?

1997-12-08 Thread Lorens Kockum

NONDEBIANPOST

On Sun, Dec 07, 1997 at 12:31:23PM +0100, Torsten Hilbrich wrote:
 
 cut doesn't buffers everything, grep is to blame.  If grep output to a
 non-terminal (e.g. a pipe) it use buffers of 4k (don't remember the
 correct value).  Unfortunatly, I don't know any way to get around
 this.

If that's the problem, then do 

tail -f file | cut -b whatever | grep whatever

and presto, you're outputting to a terminal.
Won't work, of course, if cut has the same problem.

/NONDEBIANPOST

-- 
include std_disclaim.h  Lorens KOCKUM ( [EMAIL PROTECTED] )


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


Re: Simple Unix utility?

1997-12-07 Thread Torsten Hilbrich
Jim Pick [EMAIL PROTECTED] writes:

 Now I notice that cut seems to buffer everything up.
 
 $ tail -f /opt/linuxhq/livesite/var/log/access.log |  grep -v gif | cut 
 -c1-175
 
 Is there another way around that?

cut doesn't buffers everything, grep is to blame.  If grep output to a
non-terminal (e.g. a pipe) it use buffers of 4k (don't remember the
correct value).  Unfortunatly, I don't know any way to get around
this.  Maybe you can use awk (or perl) to combine the functionality of
grep and cut in the above line.

BTW: A parameter to every program enforcing line-buffering instead of
block-buffering would be great. In this case grep would be called with
this parameter and everything works fine again.

Torsten

-- 
I haven't lost my mind -- it's backed up on tape somewhere.
Fortune Cookie
PGP Public key available


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


Simple Unix utility?

1997-12-06 Thread Jim Pick

Hi,

One task I do commonly is monitor my system log files using
'tail -f'.

I was wondering if there was a commonly used method for doing the
same thing, but filtering it at the same time.

For example, I like to view the logs on the LinuxHQ website as they are
being generated, but I don't care about gif's and jpeg's, or accesses
from my domain.  So I end up using something like this (in a wide xterm):

$ watch -n 10 'tail -100 /opt/linuxhq/livesite/var/log/access.log |
grep -v gif|jpg|jimpick\.com | tail -20 | cut -c1-175'

It works - but it obviously isn't the most efficient way of doing this.

I was wondering if there was a Unix utility I may have overlooked
that does the same sort of thing.  I know I could probably write a
Perl script to do the same thing - but it seems like a general enough
problem that there is probably something that handles it already.

Cheers,

 - Jim


pgpt6uBz78hgF.pgp
Description: PGP signature


Re: Simple Unix utility?

1997-12-06 Thread Scott K. Ellis
On 5 Dec 1997, Jim Pick wrote:

 One task I do commonly is monitor my system log files using
 'tail -f'.
 
 I was wondering if there was a commonly used method for doing the
 same thing, but filtering it at the same time.
 
 For example, I like to view the logs on the LinuxHQ website as they are
 being generated, but I don't care about gif's and jpeg's, or accesses
 from my domain.  So I end up using something like this (in a wide xterm):
 
 $ watch -n 10 'tail -100 /opt/linuxhq/livesite/var/log/access.log |
 grep -v gif|jpg|jimpick\.com | tail -20 | cut -c1-175'
 
 It works - but it obviously isn't the most efficient way of doing this.
 
 I was wondering if there was a Unix utility I may have overlooked
 that does the same sort of thing.  I know I could probably write a
 Perl script to do the same thing - but it seems like a general enough
 problem that there is probably something that handles it already.

Umm, you had the right idea when using tail -f.  Try

tail -f file | grep pattern



--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


Re: Simple Unix utility?

1997-12-06 Thread Jim Pick
Scott K. Ellis [EMAIL PROTECTED] writes:

  I was wondering if there was a commonly used method for doing the
  same thing, but filtering it at the same time.
 
 Umm, you had the right idea when using tail -f.  Try
 
 tail -f file | grep pattern

For some dumb reason, I didn't think I could do a pipe out of tail -f. 

Boy, do I feel stupid.  :-)


Now I notice that cut seems to buffer everything up.

$ tail -f /opt/linuxhq/livesite/var/log/access.log |  grep -v gif | cut 
-c1-175

Is there another way around that?

Cheers,

 - Jim


pgp8Wj1dIIKbn.pgp
Description: PGP signature


Re: Simple Unix utility?

1997-12-06 Thread Joey Hess
Jim Pick wrote:
 Now I notice that cut seems to buffer everything up.
 
 $ tail -f /opt/linuxhq/livesite/var/log/access.log |  grep -v gif | cut 
 -c1-175
 
 Is there another way around that?

Assumming you're using apache, why not set up a custom log file that has
the format you want, so you don't have to use cut.

-- 
see shy jo


pgpSIdU3nTEYC.pgp
Description: PGP signature


Re: Simple Unix utility?

1997-12-06 Thread Nicolás Lichtmaier
 Now I notice that cut seems to buffer everything up.

 You should file a bug against cut, it should do line buffering when output
is a tty.


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] . 
Trouble?  e-mail to [EMAIL PROTECTED] .


Re: Simple Unix utility?

1997-12-06 Thread Scott K. Ellis
On Sat, 6 Dec 1997, [iso-8859-1] Nicolás Lichtmaier wrote:

  Now I notice that cut seems to buffer everything up.
 
  You should file a bug against cut, it should do line buffering when output
 is a tty.

It may be something in the middle of the pipe doing the buffering.  Not
certain how to handle that case.


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word unsubscribe to
[EMAIL PROTECTED] .
Trouble?  e-mail to [EMAIL PROTECTED] .


Re: Simple Unix utility?

1997-12-06 Thread Jim Pick

Scott K. Ellis [EMAIL PROTECTED] writes:

 On Sat, 6 Dec 1997, [iso-8859-1] Nicolás Lichtmaier wrote:

   Now I notice that cut seems to buffer everything up.
 
   You should file a bug against cut, it should do line buffering when output
  is a tty.

 It may be something in the middle of the pipe doing the buffering.  Not
 certain how to handle that case.

Yes, that's the case - I had grep in the pipe before cut.

ie.

tail -f var/log/access.log | grep -v 'gif' | cut -c1-150

Maybe I'll just use a little perl script (with $|=1) to do the filtering I
want - that's probably easiest.

Cheers,

 - Jim



pgpFR3u3X4EvB.pgp
Description: PGP signature