Ich habe Logdateien von einer USV, einmal Daten:
Code:
Network Management Card AOS v6.2.1
Smart-UPS & Matrix-UPS APP v6.2.1
Date Time Name Contact Location System IP
01/21/2016 20:55:40 apc8A6DA2 Unknown Unknown 10.11.12.1
Smart-UPS 750
Date Time Vmin Vmax Vout Iout %Wout %out FrqOut %Cap Vbat Tups
01/21/2016 20:50:44 227.50 230.39 228.89 0.50 16.19 14.89 50.00 100.00 27.00 32.80
01/21/2016 20:40:44 227.50 230.39 228.89 0.53 16.19 16.19 49.97 100.00 27.00 32.80
01/21/2016 20:30:44 228.89 230.39 230.39 0.50 16.19 15.59 49.97 100.00 27.00 32.80
01/21/2016 20:20:44 228.89 230.39 230.39 0.28 9.69 9.09 50.00 100.00 27.00 32.39
01/21/2016 20:10:44 228.89 230.39 228.89 0.28 9.69 9.09 49.97 100.00 27.00 32.39
01/21/2016 20:00:44 228.89 230.39 228.89 0.28 9.69 9.09 49.94 100.00 27.00 32.80
01/21/2016 19:50:44 228.89 230.39 230.39 0.28 9.09 9.09 49.97 100.00 27.00 32.80
01/21/2016 19:40:44 228.89 230.39 230.39 0.28 9.09 9.09 50.00 100.00 27.00 32.39
01/21/2016 19:30:44 228.89 230.39 230.39 0.28 9.69 9.09 49.98 100.00 27.00 32.39
...
und Events:
Code:
Network Management Card AOS v6.2.1
Smart-UPS & Matrix-UPS APP v6.2.1
Date Time Name Contact Location System IP
01/21/2016 20:55:26 apc8A6DA2 Unknown Unknown 10.11.12.1
Date Time User Event Code
12/10/2015 19:18:54 System Network Interface coldstarted. 0x0001
12/10/2015 17:22:18 Device UPS: The output power is turned off. 0x0114
12/10/2015 17:22:18 Device UPS: The graceful shutdown period has ended. 0x014F
12/10/2015 17:22:18 Device UPS: No longer on battery power. 0x010A
12/10/2015 17:22:18 Device UPS: The power for the main outlet group, UPS Outlets, is now turned off. 0x0135
12/10/2015 17:21:55 Device UPS: Main outlet group, UPS Outlets, has been commanded to reboot with off delay. 0x0174
12/10/2015 17:16:37 Device UPS: On battery power in response to distorted input. 0x0109
11/03/2015 14:55:58 Device UPS: No longer on battery power. 0x010A
11/03/2015 14:55:24 Device UPS: On battery power in response to distorted input. 0x0109
11/03/2015 14:23:18 Device UPS: The output power is now turned on. 0x0113
11/03/2015 14:23:17 Device UPS: The power for the main outlet group, UPS Outlets, is now turned on. 0x0134
11/03/2015 14:18:19 Device UPS: The output power is turned off. 0x0114
...
Über cat, sort, uniq usw. bekomme ich es hin diese stündlich gesammelten Dateien zusammenzuführen zu einer, die alle Daten ohne mehrfache Zeilen enthält, aber wegen dem Murks-Datum am Zeilenanfang ist das Ergebnis a) schwer lesbar, da das Datum nicht streng monoton aufgebaut ist und b) ist ein Folgefehler das die sortierten Daten nicht in zeitlicher Reihenfolge sind.
Daher soll das Datum vom Format MM/DD/YYYY geändert werden nach YYYY-MM-DD, aber wie bekommt man das mit einem Skript hin?
Und wie bekommt man die Zeilen weggefiltert, die nicht mit einem Datum im Format MM/DD/YYYY beginnen?
Lesezeichen