Mon NAS crée un fichier journal au format ci-dessous:
<30>1 2014-07-21T05:02:10+02:00 ABC-NAS qlogd 6432 - - qlogd[6432]: event log: Users: Glacier, Source IP: 127.0.0.1, Computer name: localhost, Content: [Glacier] Backup job [Backup ABC-PC] finished successfully
<30>1 2014-07-21T05:02:27+02:00 ABC-NAS qlogd 6432 - - qlogd[6432]: event log: Users: Glacier, Source IP: 127.0.0.1, Computer name: localhost, Content: [Glacier] Backup job [Backup ABC-HTPC] finished successfully
<28>1 2014-07-21T05:10:59+02:00 ABC-NAS qlogd 6920 - - qlogd[6920]: event log: Users: Glacier, Source IP: 127.0.0.1, Computer name: localhost, Content: [Glacier] Backup job [Backup ABC-NAS] is abnormal shutdown
<30>1 2014-07-21T06:00:15+02:00 ABC-NAS qlogd 6920 - - qlogd[6920]: event log: Users: Glacier, Source IP: 127.0.0.1, Computer name: localhost, Content: [Glacier] Backup job [Backup ABC Metadata] started
<30>1 2014-07-21T06:00:27+02:00 ABC-NAS qlogd 6920 - - qlogd[6920]: event log: Users: Glacier, Source IP: 127.0.0.1, Computer name: localhost, Content: [Glacier] Backup job [Backup ABC Metadata] finished successfully
En utilisant un script BASH, je voudrais créer un fichier texte contenant uniquement:
Monday 21 July 2014 - 04:10 AM
Glacier Backup job [Backup ABC-PC] finished successfully
Monday 21 July 2014 - 07:02 AM
Glacier Backup job [Backup ABC-HTPC] finished successfully
etc.
J'ai essayé avec cat et grep, mais cela devient vite trop compliqué pour moi. Qui peut m'aider dans la bonne direction?
linux
bash
shell-script
format
JERO79
la source
la source