rename files[SOLVED]
Hello all,
I have 3 load balanced servers srv1 srv2 srv3 (for example) and we did not change the log files to reflect the servers so all 3 servers have combined logs that have the same name and I wish for all logs be in the same folder for Urchin so they need all different names...so I need to rename the old logs to have the follow names from : domain-combined_log-20100731.gz to domain-combined_log-srv1-120100731.gz all logs follow the same structure with the domain-combined_log-date.gz thanks! |
Quote:
A very simple bash script can do this. If you don't know how to write one, there are many bash scripting tutorials you can find via Google that can get you started. if you get stuck, post what you've written, and where you're having a problem, and we can help. |
In addition to what TB0ne said you could use LQ's search function. Renaming files is a common task. Have a look at those threads:
http://www.linuxquestions.org/questi...-files-831347/ http://www.linuxquestions.org/questi...lename-827305/ http://www.linuxquestions.org/questi...olders-804100/ http://www.linuxquestions.org/questi...751/page2.html You will find useful info to get you started. |
Quote:
|
The answer to the statement (question) is
rename '_log-' '_log-srv3-' * |
Well I am not sure about the asterix at the end, but if you have your solution you can mark the thread SOLVED by using the 'Thread Tools' menu option at the top of
your thread. |
Quote:
|
All times are GMT -5. The time now is 11:31 PM. |