how to copy an alertlog file from a particular time stamp?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to copy an alertlog file from a particular time stamp?
# 1  
Old 12-29-2008
how to copy an alertlog file from a particular time stamp?

Hi,

Can any one tell me how to copy an alertlog file from a particular time stamp using shell script?

Thanks
# 2  
Old 12-29-2008
Quote:
Originally Posted by suman_dba1
Hi,

Can any one tell me how to copy an alertlog file from a particular time stamp using shell script?

Thanks
that's by copy command ( cp ) only, can you please be more specific in your questions if possible with some mock examples?

Also, please post what you have tried so far.
# 3  
Old 12-29-2008
Hi

Actually, i need to copy an alert log file from a particular time stamp.
its like

Ex:

alertlog file
------------

xxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxx
Mon Dec 15 04:30:15 2008
xxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx
Tue Dec 16 05:40:25 2008
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxx
-----------------------------------------------

then i want to copy the file from timestamp "Tue Dec 16 05:40:25 2008" into a new file.

i hav tried like this

====================================

d="Wed Dec 17 06:50:35 2008"
cp=0
cat alert_<SID>|while read line
do
if [ $line -eq $d ]
then
cp=1
fi
if [ $cp -eq 1 ]
then
echo $line|cat a.txt
fi
done
====================================

is there any mistake in this?
# 4  
Old 12-29-2008
something like this
Code:
awk '{ if ( $0 ~ /Tue Dec/ ) { ok=1 } if ( ok ) { print } }' filename

to print lines starting from a patten match to till the end of the file.

Please correct me if I have misunderstood the problem.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check file time stamp

Hi, I need help to read file in a directory on basis of time stamp. e.g. If file access in last 2 minutes it should not be copy to remote directory. Below is my script. #!/bin/ksh DATE=`date +"%Y-%m-%d_%H%M"` SEPARATER=" " exec < out_interfaces.cfg while read source_path... (10 Replies)
Discussion started by: qamar.alam
10 Replies

2. Shell Programming and Scripting

file time stamp

Hi All, I am facing small problem. i want to print file time stamp on which date file has placed in the server. i have given some code but its not giving the year. any help appreciated. regards rajesh. (4 Replies)
Discussion started by: rajesh_pola
4 Replies

3. Shell Programming and Scripting

creating a file with time stamp

Hi guys, Here my scenario is to find the files of previous days if the previous day load had not done. for that i created a file with time stamp and this file is created after the load completes. so every dau i search for the this file with previous days time stamp. i want to create a file... (1 Reply)
Discussion started by: apple2685
1 Replies

4. Shell Programming and Scripting

Identify log files based on time stamp,zip and then copy..HELP

Hi All, PFB is a requirement. I am new to shell scripting. So plz help. It would be highly appreciated. 1. choose all the log files based on a particular date (files location is '/test/domain')--i.e,we should choose all the files that are modified on 29th November, neither 28th nor 30th 2.... (3 Replies)
Discussion started by: skdas_niladri
3 Replies

5. Shell Programming and Scripting

Change time stamp of a file

Hi, As i know , we can change the time stamp of a file by touch command, i did change in a file and it is looking as given # ls -l abcd -rw-r--r-- 1 batsoqa sicusers 0 Feb 17 2010 abcd actually i want to see the output like this -rw-r--r-- 1 batsoqa sicusers ... (3 Replies)
Discussion started by: apskaushik
3 Replies

6. Shell Programming and Scripting

change the time stamp of file

can we change the timestamp of a file to old date. -rwxrwxrwx 1 root other 330 Jul 1 16:03 abc.txt it shows creation time is 16.03 can i change it to previous time :) (2 Replies)
Discussion started by: anish19
2 Replies

7. UNIX for Dummies Questions & Answers

Copy all the files with time stamp and remove header,trailer from file

All, I am new to unix and i have the following requirement. I have file(s) landing into input directory with timestamp, first i want to copy all these files into seperate directory then i want to rename these files without timestamp and also remove header,trailer from that file.. Could... (35 Replies)
Discussion started by: ksrams
35 Replies

8. Shell Programming and Scripting

how do i put a time stamp in a file name

i want to copy a filea.dat to a file name in the format of filea_yyyymmdd_hhmi.dat using something like DTSTAMP=$(date "+%Y%m%d"), which puts it in format filea_yyyymmdd.dat (5 Replies)
Discussion started by: jhamm
5 Replies

9. UNIX for Dummies Questions & Answers

ftp copy: preserve source file date stamp

Is there any way to preserve a file's create/mod date stamp when it is "put" via ftp (or even using Fetch) to a Win2K server and a SunOS 5.8 server? For example, if I copy a file with a create/mod date of "01/15/2005 3:36 PM" to my Win2K or SunOS ftp server, the date stamp will change to the... (5 Replies)
Discussion started by: cassj
5 Replies

10. UNIX for Dummies Questions & Answers

time stamp of file create

Hi, Sounds a simple request but I also need (would like) to gather the seconds too. I'm not even sure if this is held. I would think it is, somewhere??!!?! I belive that stat would/could work but I don't do C (we'll not yet). Is there any comamnd line util I can use? SunOS. Cheers... (7 Replies)
Discussion started by: nhatch
7 Replies
Login or Register to Ask a Question