Re: lug-bg: tail -f | grep ... | cat ... | awk ...
- Subject: Re: lug-bg: tail -f | grep ... | cat ... | awk ...
- From: danchev@xxxxxxxxx (George Danchev)
- Date: Thu, 31 Jan 2002 11:45:34 +0200
On Thursday 31 January 2002 11:26, you wrote:
> ami to ne izliza ot 'tail -f' prosto tova se prekysva samo s ctrl+c (mai)
> taka che pishi 'tail -10 blabla |awk ....'
da to4no taka ... no ima i edin slu4aj kogato tail -f terminira kogato edi
koj si process zavurshi... (tail -f --pid=edi_koj_si ;)
---------- Forwarded Message ----------
Subject: Re: Problem
Date: Thu, 31 Jan 2002 11:35:38 +0200
From: George Danchev <danchev@xxxxxxxxx>
To: Vesselin Kolev <vlk@xxxxxxxxxxxxxxxxx>
On Thursday 31 January 2002 10:48, you wrote:
> Zdravei...
>
> Obache otnovo ima problem...
>
> Ako se predade potoka koito idva kato rezultat ot programata cat
> ime_na_file vsichko opisano dolu raboti prekarsno i izvlicha IP adresite...
> No ako se pusne potoka ot tail -f ima_na_file ne raboti izobshto...
>
> Imash li niakakva ideia zashto>
ami "tail -f" prosto ne terminira , t.e. ne zavyrshva ( ne quit() ) i t.k.
ne oformq potok za predavane po natatyk po pipa-a... Ima edin slu4aj kogato
"tail -f" mozhe da terminira, naprimer, tail -f ste zavyrshi rabota kogato
procesa s PID=455 zavurshi:
tail -f --pid=455
No, ti mozhesh da polzvash naprimer:
tail -n20
tail --lines=20
za da izvadish poslednite 20 lines ot file-a, stoto po default tail vadi
poslednite 10.
No mi se struva 4e da go izpylnqvash s cat|grep prez izvestno vreme s edin
bezkraen cykul e po uda4no:
#!/bin/bash
z=0;
while [ $z != 1 ] ; do
cat yourfile.log | grep "Ip hdr" | .....
sleep 60
done
V krajna smetka ti she INSERT-vash s iptables ... i dori i da insertnesh
IP-ta koito ve4e sa bili instrtnati to tova ne e problem.
Vse pak postni celiq sutiation v lug-a.... nqkoij mozhe i da ima po umna
ideq-;)
> Vesselin
>
>
> ako sym te razbral pravilno pyrviq IP ste go izvadidsh s nesto ot sorta na:
> (tova ako si siguren 4e ste e 4-ta kolona vinagi)
> ......| grep "Ip hdr" | awk '{print $4}'
>
> ili:
> (vadish sydurzhanieto mezhdu ograni4itelite ":" i "->" )
> ......| grep "Ip hdr" | awk -F "->" '{print $1}' |cut -d : -f2
> ili:
> ..... | grep "Ip hdr" | cut -d : -f2 | awk -F "->" '{print $1}'
>
> i po natatyk pipe-a prodlzhava ... ili sybirash IP-tata v file i posle s
> edin for i in `cat file` ; do .... gi podavash na iptables .... malko
> fantaziq i gotovo :)
>
> P.S. just Fast&Dirty, not tested at all !
--
Greets,
fr33zb1
-------------------------------------------------------
--
Greets,
fr33zb1
===========================================================================
A mail-list of Linux Users Group - Bulgaria (bulgarian linuxers)
http://www.linux-bulgaria.org/ Hosted by Internet Group Ltd. - Stara Zagora
|