Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

logging date and time to file ? new to awk

Status
Not open for further replies.

Delphiwhat

Programmer
Joined
Apr 1, 2003
Messages
74
Location
EU
Hi all

Could someone show me how to log
the system date, time and a bit of text to a log file. I basically want to open the same log file each time and write something like

'AUG 06 2004 13:41 HRS files>20!@'


so over a period of time I have 1 log file with a complete historical record of when my directory has had more than 20 files in it.

thanks

S
 
Code:
BEGIN {
  date="date '+%b %d %Y %H:%M HRS files>20!@'"
  logFile="delph.txt"
  cmd=date " >>" logFile
}

{
   system(cmd);
   close(cmd);
}

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
I know is AWK forum, but why not issue comand directly?
Code:
date '+%b %d %Y %H:%M HRS files>20!@'>>logfile


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top