Adding date to oracle exp log


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Adding date to oracle exp log
# 1  
Old 11-06-2008
Question Adding date to oracle exp log

I want to add a date/time stamp to the front of each line in an oracle exp log file. I created a shell script:

rm -f expTest.Pipe
mknod expTest.Pipe p
date "+%Y.%m.%d %T"
nawk -f expTest.nawk expTest.Pipe > expTest.Tlog &
exp userid=UID/PW@DB file=expTest.dmp log=expTest.log owner=OWNER 2>> expTest.Pipe
date "+%Y.%m.%d %T"
rm -f expTest.Pipe

and a nawk script (expTest.nawk):

BEGIN {
DT= "date \"+%Y.%m.%d %T\""
DT | getline cur_date
close(DT)
}
{
print cur_date, $0;
}

But when run, the date values are all the same (the start time of the script), even thought this takes about 60 seconds to complete.

Running on Solaris. I've tried awk but it repeatedly fails on the 'DT | ...' line

What am I doing wrong? Thanks in advance.
# 2  
Old 11-06-2008
Just realized BEGIN means something different than I'm use to.

This works:

BEGIN {
start_date=srand()
# print start_date;
}
{
DT="date \"+%Y.%m.%d %T\""
DT | getline cur_date
close(DT)
}
{
print cur_date, $0;
}
END {
end_date=srand()
# print end_date;
print "Run Time (in seconds): ",end_date-start_date;
}
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete log files content older than 30 days and append the lastest date log file date

To delete log files content older than 30 days and append the lastest date log file date in the respective logs I want to write a shell script that deletes all log files content older than 30 days and append the lastest log file date in the respective logs This is my script cd... (2 Replies)
Discussion started by: sreekumarhari
2 Replies

2. UNIX for Dummies Questions & Answers

Adding hours and minutes to current date (Only to date not to time)

Hi, I want to add some hours and minutes to the current date. For example, if the current date is "July 16, 2012 15:20", i want to add 5 hours 30 minutes to "July 16, 2012 00:00" not to "July 16, 2012 15:20". Please help. Thanks! (4 Replies)
Discussion started by: manojgarg
4 Replies

3. Shell Programming and Scripting

Adding days to system date then compare to a date

Hi! I am trying to read a file and every line has a specific date as one of its fields. I want to take that date and compare it to the date today plus 6 days. while read line do date=substr($line, $datepos, 8) #date is expected to be YYYYMMDD if ; then ...proceed commands ... (1 Reply)
Discussion started by: kokoro
1 Replies

4. Shell Programming and Scripting

cp -p /home/* home/exp/*.date not working please help

:( ---------- Post updated at 01:51 AM ---------- Previous update was at 01:50 AM ---------- Not working ---------- Post updated at 02:04 AM ---------- Previous update was at 01:51 AM ---------- cp -p /home/* home/exp/*.`date` i am using this (4 Replies)
Discussion started by: rishiraaz
4 Replies

5. Programming

Oracle: adding numbering to a table...

As a disclaimer, I am not a database person. I have some basic knowledge, but my area is in other fields. Please treat me like I am stupid when it comes to this question. An Oracle script has been dumped on me, which I have been able to work out an understanding of, but I need to make a change... (5 Replies)
Discussion started by: Elric of Grans
5 Replies

6. UNIX for Dummies Questions & Answers

extract a part of a path like (input: /etc/exp/home/bin ====> output: exp)

Hi, I need to make some extraction . with the following input to get the right output. input: /etc/exp/home/bin ====> output: exp and input: aex1234 ===> output: ex Thanks for your help, (4 Replies)
Discussion started by: yeclota
4 Replies

7. UNIX for Dummies Questions & Answers

Adding date and time to a log file

Morning all Im hoping you can help me. We have a nice new oracle server :( and are needing to move some files around for EDI and BACS. The server runs windows but has an app called MKS toolkit installed which give unix commands. (Needed for the oracle stuff) I have had a go using dos commands... (2 Replies)
Discussion started by: ltodd2
2 Replies

8. UNIX for Dummies Questions & Answers

Adding a date as a first column

I want to add a date to a record which is appended to a file that gets its data from an external source. An explanation: 1. Getting external data: curl http://www.example.com/temperatures.txt 2. Getting the required record: | grep mylocation 3. Appending to file: >> mytemperatures.txt ... (2 Replies)
Discussion started by: figaro
2 Replies

9. Shell Programming and Scripting

adding date to cron log

Hi. I'm trying to output the current date to a cronjob log file. Nothing seems to work, echo $(date), echo `date` or just date in the script. I'm using /sbin/sh Any ideas? Thanks, John (2 Replies)
Discussion started by: JohnH
2 Replies
Login or Register to Ask a Question