Unix/Linux Go Back    


UNIX for Dummies Questions & Answers This forum is closed for new posts. Please post beginner questions to learn unix and learn linux in this forum UNIX for Beginners Questions & Answers

Adding date and time to a log file

UNIX for Dummies Questions & Answers


Tags
shell script, shell scripting, unix commands, unix scripting, unix scripting basics

 
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 12-15-2008   -   Original Discussion by ltodd2
ltodd2 ltodd2 is offline
Registered User
 
Join Date: Dec 2008
Last Activity: 9 May 2011, 3:50 AM EDT
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Adding date and time to a log file

Morning all

Im hoping you can help me. We have a nice new oracle server Linux 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 in a batch file and also using things like touch but am not getting anywhere.
What im wanting it to copy files from the out folder into an edi folder and then move the files from the original out to an archive. Im wanting to log what is copied and moved. They want it to run every 10mins so I would like to create one log file per day and have the time in the file before the files are copied so we can look back and see what happend at what time.
My current attempt:
copy /V E:\oracle\uatcomn\admin\out\UAT_wendy\p??????.mf e:\edi\edi_out >> e:\edi\copy.log this works but just adds and adds.

This is probably very simple but its beating me Linux

Thanks

Lee
Sponsored Links
    #2  
Old Unix and Linux 12-15-2008   -   Original Discussion by ltodd2
vbe's Unix or Linux Image
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 22 November 2017, 3:47 PM EST
Location: Switzerland - GE
Posts: 6,479
Thanks: 289
Thanked 553 Times in 515 Posts
Dont know about DOS... why arent you using your MKS toolkit shell to do the job then?

This will show you the idea:

Code:
ant:/home/vbe $ echo "Date: " $(date)
Date:  Mon Dec 15 15:30:35 MET 2008

All you have to do is redirect that line (>>) in you log, then do the copy/moves etc...
Sponsored Links
    #3  
Old Unix and Linux 12-15-2008   -   Original Discussion by ltodd2
ltodd2 ltodd2 is offline
Registered User
 
Join Date: Dec 2008
Last Activity: 9 May 2011, 3:50 AM EDT
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
VBE

Thanks for the hint, Im not good at scripts, still learning. How would I make a file with that days date and within that file prefix each set of data with the time?

Lee
Sponsored Links
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding date and time to file name cc_at_work Shell Programming and Scripting 7 11-15-2010 04:27 AM
Adding Date & time stamps to filename manish.s UNIX for Dummies Questions & Answers 1 03-13-2009 05:00 AM
problem with displaying date and adding time FuncMx Shell Programming and Scripting 1 10-10-2008 01:06 AM
Processing a log file based on date/time input and the date/time on the log file primp Shell Programming and Scripting 4 03-16-2008 12:23 PM



All times are GMT -4. The time now is 03:42 AM.