I’m trying to figure out how I would go about parsing a group of files
containing raw log data (results of crontab -l) and convert this data
into a human readable format. The entries in the files are like so:
Note that I left the ‘?’ for the number of servers as that is your
problem - Think of it as an exercise for the reader
Also you might also need to match the Paul Vixie extensions for cron
such as @hourly and @daily
Thanks for the reply. This looks like a step in the right direction. The
only problem that I can think of is that the cron jobs aren’t always
going to have the same time, so I don’t think having the " a =
“10,25,40,55 * * * *” portion would work, as it would probably only find
one entry of that since the times the crons execute are always going to
vary.
The a = “…” part was to allow me to give you a runnable example, you
will have to figure out how to read the crontabs yourself. I dont know
how your system is set up. Also Ammar A.'s suggestion is a
considerable improvement on my code, you should go with that.
Thanks for the reply. This looks like a step in the right direction. The
only problem that I can think of is that the cron jobs aren’t always
going to have the same time, so I don’t think having the " a =
“10,25,40,55 * * * *” portion would work, as it would probably only find
one entry of that since the times the crons execute are always going to
vary.
split takes a second argument that specifies a limit. It will greatly
simplify parsing the lines in this case.