Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Currently I have something like this:

./player_script |grep "videoname" >> log.log &

The output of player_script shows when a video starts and ends, grep then takes only certain video file names and puts them into log.log.

So log.log will look something like this:

video <videoname> is playing now
video <videoname> ended
video <videoname> is playing now
video <videoname> ended

... and so on.

What I need is the timestamp of when the file starts and ends on each new line, in this format:

Feb 28 15:35:32 video <videoname> is playing now

I also need the date on the log file: log2012-02-29.log.

This is being run on Solaris 5.8 & 5.9.

share|improve this question
Let me see if I understand the first part. You want to add to the output of log.log a timestamp of when each video start and stops? If so, that's something that the video player script will have to do. That being said, perhaps you can post your player_script and we can take a look under the hood. – Carlos Feb 29 '12 at 1:48

To answer your 2nd part, it's pretty easy. Instead of log.log, use the following:

log`date '+%Y-%m-%d'`.log

Pay particular attention that there are 'backticks' that wrap the date command. That tells the shell to execute that first and plaster the results onto your command line to make it a part of your filename.

share|improve this answer
this works, thanks! – reyes Feb 29 '12 at 18:30
@reyes, please accept this answer – Yedric Sep 27 '12 at 16:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .