admine
23-04-2007, 13:22
Hallo,
folgendes Problem quält mich grad :(
Gegeben ist ein File bestehend aus gesammelten root-Mails.
Sieht so aus:
Auszug:
From root Fri Apr 20 11:01:06 2007
...
(980427.SGI.8.8.8/980728.SGI.AUTOCF) id LAA55707 for root; Fri, 20 Apr 2007 11:01:06 +0200 (MDT)
Date: Fri, 20 Apr 2007 11:01:06 +0200 (MDT)
From: root (Super-User)
...
Subject: cron <root@server1> /var/tmp/SW_VERTEIL/sh.kontrolle_o21_lmstat
--------------------------------------------------------------------------------------------
Pflege auf Rechner server2 Pflege auf Rechner server2
--------------------------------------------------------------------------------------------
...
...
Users of 226821: (Total of 2 licenses issued; Total of 2 licenses in use)
lmstat - Copyright (C) 1989-2002 Macrovision Corporation
Flexible License Manager status on Fri 4/20/2007 11:00
Users of 226825: (Total of 7 licenses issued; Total of 7 licenses in use)
"226825" v3.200, vendor: SNIAG
floating license
.
.
.
Pflege auf Rechner server2 ADI-Lizenz Rechner server2
lmstat - Copyright (C) 1989-2002 Macrovision Corporation
Flexible License Manager status on Fri 4/20/2007 11:00
Users of 226895: (Total of 8 licenses issued; Total of 5 licenses in use)
.
.
.
--------------------------------------------------------------------------------------------
Pflege auf Rechner server3 Pflege auf Rechner server3
--------------------------------------------------------------------------------------------
.
.
Users of 226821: (Total of 2 licenses issued; Total of 0 licenses in use)
lmstat - Copyright (C) 1989-2002 Macrovision Corporation
Flexible License Manager status on Fri 4/20/2007 11:00
Users of 226825: (Total of 6 licenses issued; Total of 5 licenses in use)
.
.
Aus diesen Mails benötige ich bestimmte Zeilen, welche in ein File geschrieben werden sollen.
Das Ergebnis sollte dann so ausschaun:
Date: Fri, 20 Apr 2007 11:01:06 +0200 (MDT)
Pflege auf Rechner server2
Users of 226825: (Total of 7 licenses issued; Total of 7 licenses in use)
Pflege auf Rechner server3
Users of 226825: (Total of 6 licenses issued; Total of 5 licenses in use)
Nur leider bekomm ich das nicht hin.
Versucht hab ich bisher das:
#!/bin/bash
FILE=MAIL_LIZ_2006_07
for i in `cat $FILE`;
do
grep "Date:" $i >> pcxt
grep "Pflege auf Rechner" $i >> pcxt
grep "Users of 226825" $i >> pcxt;
done
Laufen soll es auf IRIX 6.5.6 in einer bash.
Könnt ihr mir helfen bzw. Tipps geben?
Danke und Gruß,
admine
EDIT: hab die "echo"s im Script entfernt ... das sollte IMHO ohne gehen.
Auf der Zeile funzt jeder grep für sich, so wie ich will :(
folgendes Problem quält mich grad :(
Gegeben ist ein File bestehend aus gesammelten root-Mails.
Sieht so aus:
Auszug:
From root Fri Apr 20 11:01:06 2007
...
(980427.SGI.8.8.8/980728.SGI.AUTOCF) id LAA55707 for root; Fri, 20 Apr 2007 11:01:06 +0200 (MDT)
Date: Fri, 20 Apr 2007 11:01:06 +0200 (MDT)
From: root (Super-User)
...
Subject: cron <root@server1> /var/tmp/SW_VERTEIL/sh.kontrolle_o21_lmstat
--------------------------------------------------------------------------------------------
Pflege auf Rechner server2 Pflege auf Rechner server2
--------------------------------------------------------------------------------------------
...
...
Users of 226821: (Total of 2 licenses issued; Total of 2 licenses in use)
lmstat - Copyright (C) 1989-2002 Macrovision Corporation
Flexible License Manager status on Fri 4/20/2007 11:00
Users of 226825: (Total of 7 licenses issued; Total of 7 licenses in use)
"226825" v3.200, vendor: SNIAG
floating license
.
.
.
Pflege auf Rechner server2 ADI-Lizenz Rechner server2
lmstat - Copyright (C) 1989-2002 Macrovision Corporation
Flexible License Manager status on Fri 4/20/2007 11:00
Users of 226895: (Total of 8 licenses issued; Total of 5 licenses in use)
.
.
.
--------------------------------------------------------------------------------------------
Pflege auf Rechner server3 Pflege auf Rechner server3
--------------------------------------------------------------------------------------------
.
.
Users of 226821: (Total of 2 licenses issued; Total of 0 licenses in use)
lmstat - Copyright (C) 1989-2002 Macrovision Corporation
Flexible License Manager status on Fri 4/20/2007 11:00
Users of 226825: (Total of 6 licenses issued; Total of 5 licenses in use)
.
.
Aus diesen Mails benötige ich bestimmte Zeilen, welche in ein File geschrieben werden sollen.
Das Ergebnis sollte dann so ausschaun:
Date: Fri, 20 Apr 2007 11:01:06 +0200 (MDT)
Pflege auf Rechner server2
Users of 226825: (Total of 7 licenses issued; Total of 7 licenses in use)
Pflege auf Rechner server3
Users of 226825: (Total of 6 licenses issued; Total of 5 licenses in use)
Nur leider bekomm ich das nicht hin.
Versucht hab ich bisher das:
#!/bin/bash
FILE=MAIL_LIZ_2006_07
for i in `cat $FILE`;
do
grep "Date:" $i >> pcxt
grep "Pflege auf Rechner" $i >> pcxt
grep "Users of 226825" $i >> pcxt;
done
Laufen soll es auf IRIX 6.5.6 in einer bash.
Könnt ihr mir helfen bzw. Tipps geben?
Danke und Gruß,
admine
EDIT: hab die "echo"s im Script entfernt ... das sollte IMHO ohne gehen.
Auf der Zeile funzt jeder grep für sich, so wie ich will :(