Hi everybody,
I'd like to think I've been through the search tool not only on this site, but also on google too, but I haven't been able to find what I was looking for. If I might've missed something on this forum, please slap me in the face with a link that you consider useful for my query
I got a bunch of backup jobs that I need to order and grep only for those with errors:
Notice there are jobs which finish with status code 0 (on column 4 - meaning they're successful) and those with 196 (un-successful). I would like to print out only the lines containing jobs that DON'T finish successfully and order them by date. What I've managed to do was to use the sort -k 4,7 (column 7 is the starting date of the job) but I would also need to exclude from the printed lines those that don't matter to me (for example jobs that have failed 2 days ago... if we're on Sept 25, I'd like to have only lines containing failed jobs from Sept 25, NOT Sept 23rd). I think this is easy for most of the gurus here, but I'm just a storage guy, so do forgive my lack of knowledge on this :o
It would be simpler if the date was stored in YYYYMMDD format.
Some of your field numbers were wrong. Field "2", for example, is actually two fields in some cases. It's possible that the actual output is tab-delimited, but you just didn't paste it properly here?
This will add an extra field with that data format, then sorting is easier...
If predictions are right, it's not only the American date format that will suffer, but all of us... and yeah, thanks for the effort Scott, but you went way beyond what I actually needed... It's like in string theory: it's absolutely wonderful mathematically, but no one can prove it right...