Zeile für Zeile vergleichen ??? mit while und readline?

M

Misogi

Grünschnabel
Halli Hallo ^^

Ich beschäftige mich seit kurzem mit dem Linux-System und versuche mich ein bisschen mit Befehlen herumzuspielen.
Mich interessiert nämlich Folgendes:

Also, ich hab ein Log-file, das Ereignisse aufzeichnet. (siehe unten, ein kleiner Ausschnitt)

Code:
Aug 24 11:30:57 [B]DEBUG[6034][/B] chan_iax2.c: Really destroying IAX2/10.88.250.50:4569-10 now...
Aug 24 11:30:57 [B]VERBOSE[6034][/B] logger.c:     -- Hungup 'IAX2/10.88.250.50:4569-10'
Aug 24 11:30:57 [B]WARNING[4617][/B] chan_iax2.c: Received mini frame before first full voice frame
Aug 24 11:30:57 [B]WARNING[4617][/B] chan_iax2.c: Received mini frame before first full voice frame
Aug 24 11:30:57 [B]WARNING[4617][/B] chan_iax2.c: Received mini frame before first full voice frame
Aug 24 11:30:58 [B]WARNING[4617][/B] chan_iax2.c: Received mini frame before first full voice frame
Aug 24 11:30:58 [B]DEBUG[4617][/B] chan_iax2.c: Ooh, voice format changed to 1024
Aug 24 11:30:58 [B]DEBUG[4617][/B] chan_iax2.c: Raw Hangup 10.88.250.50:4569, src=11, dst=13
Aug 24 11:31:00 [B]DEBUG[4617][/B] chan_iax2.c: Raw Hangup 10.88.250.50:4569, src=0, dst=13
Aug 24 11:31:00 [B]DEBUG[4617][/B] chan_iax2.c: Raw Hangup 10.88.250.50:4569, src=10, dst=12
Aug 24 11:31:00 [B]DEBUG[4617][/B] chan_iax2.c: Raw Hangup 10.88.250.50:4569, src=10, dst=12
Aug 24 11:31:00 [B]DEBUG[4617][/B] chan_iax2.c: Raw Hangup 10.88.250.50:4569, src=11, dst=13
Aug 24 11:31:00 [B]DEBUG[4617][/B] chan_iax2.c: Received VNAK: resending outstanding frames
Aug 24 11:31:00 [B]DEBUG[4617][/B] chan_iax2.c: Received VNAK: resending outstanding frames

Mit dem Befehl:

Code:
grep -i warning logfile > warnings.txt

Habe ich die WARNINGS rausgefiltert und in ein Text-file umgeleitet.

Das Problem ist, dass viele gleiche WARNING-Ereignisse vorkommen. Ich hab mit "cut" die Uhrzeit und das Feld WARING[nr.] ausgeblendet. Das wird dann so ausschauen:

Code:
Aug 24 chan_iax2.c: Received mini frame before first full voice frame
Aug 24 chan_iax2.c: Received mini frame before first full voice frame
Aug 24 chan_iax2.c: Received mini frame before first full voice frame
Aug 24 chan_iax2.c: Received mini frame before first full voice frame

Frage: Wie funktioniert das mit while und read. Dass ich Zeile für Zeile vergleiche, und dann sie nur einmal ausgebe ?

LG, Misogi ^_^
 
Ich denke mal, dass uniq Dir hilft.

Gruss, Xanti
 
Hallo

Zu uniq sei aber angemerkt, dass es nur funktioniert wenn die Daten sortiert sind.
Code:
sort datei|uniq
Manche Versionen von sort kennen auch die Option -u für:
"nur das erste Element von mehreren gleichen ausgeben."

Gruß Wolfgang
 
^_^ Vielen Dank!
Der uniq-Befehl hat mir sehr geholfen!

Lg, Misogi ^_~
 

Ähnliche Themen

Router crash bei Fedora 15!?

Displayport + externer Monitor zeigt bei startx nichts erst bei DVI

Rollei Mini Wifi Camcorder

NagiosGrapher 1.7.1 funktioniert nicht

[Ubuntu 10.04] Netzwerk läuft nicht mehr richtig

Zurück
Oben