ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What I want to do is, get the last applied number from alert.log which is 25.(Media Recovery Log /oracle/archives/arch_1_25_691513588.arc)
Copy the files from /oracle/archives
from number 25 to greatest number which is 30 to some other directory (/oracle/temp).
How can I write such a script? I gave these numbers as an example.
Thanks in advance
Last edited by scofiled83; 07-06-2009 at 03:19 AM.
Ghostdog you helped me a lot before, I guess you will again help me in this issue
These numbers will always increment. I dont have any script yet and dont know how to start
Last edited by scofiled83; 07-06-2009 at 03:39 AM.
You are right ghostdog, but I havent decided how to start where to start, etc...
If I got somethings I will work on them.
I really aprreciate if you help me in this issue
Mon Jul 6 19:54:47 2009 Media Recovery Log /oracle/archives/arch_1_20_691513588.arc
Assuming the above log line is on one line and the file names don't change except the _20_:
for i in `cat alert.log | awk '{print $9}' | cut -b 25-26`;
do
echo "copying arch_1_"$i"_691513588.arc to /some/where"
done
I'm no expert and this is a rough but also an easy task. Of course you have to fix it up to make the copy actually happen. replacing the echo with your cp command etc. Think you can do it? It's a start'
I can get the last applied number from alert.log.
I am thinking to write this number to a file and rcp this file other server, read this number from file and copy logs from /oracle/archives.
Is there any other suggestion????
Last edited by scofiled83; 07-06-2009 at 03:11 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.