With this entry from our crontab
1 3 1 * * find /var/log/tomcat/* -mtime +61 -type f -delete
I want to match the 5th space char so I can separate the command part from the time field part. Cron can have different formats, so I want to be able to match DOW as sun or 0.
The regular expression I am using in vim that matches the first space is and replaces with place holder "T".
:g/\*/s/\(\ \)\{1\}/T/
What am I missing to match the nth or 5th space. This does does nothing
:g/\*/s/\(\ \)\{5\}/T/
I want to generate a break down of when commands are run in cron to try and balance out the load on our servers.
Addendum
I understand what I was doing wrong with the above search / substitutions.
(\ \)\{5\}
That gets expanded to five spaces after each other and not the 5th space as there are chars between the spaces.
This work up to the fifth space but the replacement "\1" dose not include the whole of the matched atom.
:g/*/s/\([0-9A-Za-z*\/,]* \)\{5}/\1 T /
it leaves the following after replacement.
* T find /var/log/tomcat/* -mtime +61 -type f -delete
I am looking for
1 3 1 * * T find /var/log/tomcat/* -mtime +61 -type f -delete