in reply to Grep options?
Also, please explain how the extensions .out and .log should be derived from the other information. As posted, your question is impossible to answer.