LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-09-2010, 10:11 AM   #1
knockoutned
LQ Newbie
 
Registered: Jul 2010
Posts: 5

Rep: Reputation: 0
appending a time stamp to prstat


Hi,

I am trying to run prstat for an extended time, outputting to a file and appending a time-stamp to each line (running on Solaris 10). I have tried this:

prstat -c -U usrname 60 480 | nawk '$1=="PID" { "date +%d%m%Y-%H:%M:%S" | getline d ; close("date") } { print d,$0 }' > /tmp/fileName &

this only appends the time the command was started to each line. I would like to fix this so that a new time is recorded every 60 seconds.

Thanks in advance
 
Old 08-09-2010, 05:57 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
How about using 'logger'? That way you get a perfect syslog-style date-and-time stamp each and every time.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with time stamp script bufo Linux - General 3 10-25-2009 02:31 AM
presentation time stamp nesta Programming 1 11-24-2006 01:57 AM
Time stamp Kalyani1 Linux - Software 0 11-07-2005 02:58 PM
set up the Time stamp Kalyani1 Linux - Software 3 11-06-2005 02:36 PM
Time stamp in Samba is 11 hours behind time stamp in Linux Linh Linux - General 3 09-04-2003 12:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration