abstract:
more timefile_2.txt
-rw-r--r-- 1 root other 0 Jun 21 17:13 test123.txt
-rw-r----- 1 sybase other 2096629760 Jun 24 10:01 hello.txt
-rw-r--r-- 1 root other 0 Jun 24 10:58 timefile_2.txt
*********************************************************
My aim is to capture the results (all 3 results) of the time command (I need to do some arithmetic calculations on the values)
I'm working on a
SunOS 5.9 Generic_112233-12 sun4u sparc SUNW,Sun-Fire-V440
server
I have a problem controlling the output from the UNIX time command, for some strange reason the "output" (specifically the last 3 lines of the output) seems like it can only be directed to the screen, no matter what I do:
Take for example I tried this:
bash-2.05#
( time ls -ltr) | tail -3 > timefile_1.txt
real 0m0.008s
user 0m0.000s
sys 0m0.010s
I then looked at the contents of the file
timefile_1.txt
and I saw this :
bash-2.05#
more timefile_1.txt
-rw-r--r-- 1 root other 201 Jun 24 10:58 abc123.txt
-rw-r----- 1 sybase sybase 2096629760 Jun 24 11:01 tempdb_dev
-rw-r--r-- 1 root other 0 Jun 24 11:42 timefile_1.txt
**********************************************************
So I experimented some more :
bash-2.05# ( time ls -ltr) | tail -3 > timefile_2.txt 2>&1
real 0m0.009s
user 0m0.010s
sys 0m0.000s
As you can see below the last 3 lines of the
ls -ltr
command has been redirected to the
timefile_2.txt
file, I need the above 3 lines from the time command
bash-2.05#
more timefile_2.txt
-rw-r--r-- 1 root other 0 Jun 21 17:13 test123.txt
-rw-r----- 1 sybase other 2096629760 Jun 24 10:01 hello.txt
-rw-r--r-- 1 root other 0 Jun 24 10:58 timefile_2.txt
*********************************************************
My aim is to capture the results (all 3 results) of the time command (I need to do some arithmetic calculations on the values)
I'm working on a
SunOS 5.9 Generic_112233-12 sun4u sparc SUNW,Sun-Fire-V440
server |