Page 1 of 1

Searching file contents for values different to a set value

PostPosted: Thu Aug 17, 2017 10:07 am
by dekyras
Hi,

I'm trying to use Hazel to assess if a backup job has succeeded by examine the log file.

To do this I need to determine if ANY of the following is true

1. Number of skipped files > 0
2. Number of mismatched files > 0
3. Number of failed files > 0
4. Ended date <> yesterdays date

A sample input is
**************************************
Total Copied Skipped Mismatch FAILED Extras
Dirs : 10266 0 0 0 0 0
Files : 200825 2 200823 0 0 0
Bytes : 79.224 g 239.8 k 79.224 g 0 0 0
Times : 0:16:03 0:00:00 0:00:00 0:16:02


Speed : 314033 Bytes/sec.
Speed : 17.969 MegaBytes/min.
Ended : 12 August 2017 17:48:03
*****************************************

Any idea if this can be achieved and if so any pointers would be most gratefully received

Dek

Re: Searching file contents for values different to a set va

PostPosted: Thu Aug 17, 2017 10:17 am
by Mr_Noodle
You'll need to write a script to parse that file. There are tons of different approaches for this but the quickest way might be using the "grep" command in a shellscript. I'd search around on how to use grep as well as shell scripting if you aren't familiar with it.