[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: tail and grep



On Tue, 7 Jul 1998, Patrick Olson wrote:
> when I try tail -f /var/log/messages | grep "local  IP"
> 
> it prints (with a real IP address instead of 123.123.123.123)
> 
> Jul  7 20:06:00 server2 pppd[587]: local  IP address 123.123.123.123
> 
> on my console.  That's exactly what it should do.  But if I try to
> redirect it to a user's file (so he can see what his dynamic IP is) using
> 
> tail -f /var/log/messages | grep "local  IP" > /home/pppusers/dynamic.IP
> 
> it does nothing but create a 0 byte file.
> 
> Questions:
> 
> 1. What am I doing wrong?

The reason the redirection doesn't work as expected is that "tail -f" doesn't
send EOF, so although /home/pppusers/dynamic.IP gets opened the buffer doesn't
get flushed, so the file doesn't get written to.

Cheers,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding@nessie.mcc.ac.uk>
Date: 08-Jul-98                                       Time: 12:31:15
--------------------------------------------------------------------


--  
Unsubscribe?  mail -s unsubscribe debian-user-request@lists.debian.org < /dev/null


Reply to: