If you're doing some textual manipulation of a file/files, at what point do you decide to automate the process (using your favorite scripting language or writing a macro in a tool) ?
Is it after a certain number of repetitions or based on the likelihood you'll need to repeat the process ?
Is it productive to automate a task if creating the automation takes longer than completing the process by hand ?