Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^5: Append the timestamp before and after the data in the logfile

by blazar (Canon)
on Dec 27, 2005 at 14:07 UTC ( #519328=note: print w/replies, xml ) Need Help??


in reply to Re^4: Append the timestamp before and after the data in the logfile
in thread Append the timestamp before and after the data in the logfile

There's an important difference. AFAIK 'time' is not a program, but a shell command. It prints to STDERR, so you can't capture it with a plain '>' redirection, but even a '2>' won't do, since you have to capture the output of the whole pipeline:
$ time perl -le 'print "foo"; sleep 1' >/dev/null real 0m1.017s user 0m0.003s sys 0m0.002s $ time perl -le 'print "foo"; sleep 1' 2>/dev/null foo real 0m1.012s user 0m0.003s sys 0m0.004s $ (time perl -le 'print "foo"; sleep 1') >/dev/null real 0m1.012s user 0m0.002s sys 0m0.004s $ (time perl -le 'print "foo"; sleep 1') 2>/dev/null foo $ { time perl -le 'print "foo"; sleep 1'; } 2>/dev/null foo
  • Comment on Re^5: Append the timestamp before and after the data in the logfile
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://519328]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2018-02-25 04:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (312 votes). Check out past polls.

    Notices?