get only the up time from uptime command

Hi all,:o
i am new to shell scripting and i have aproblem like i just want to extractthe uptime of the system from an uptime command which gives the output as the Current time , how long the system has been running,how many users are surrently logged on and the system load averages for past 1,5, and 15 mins.
from this i just need the time when system has been running.
can someone help me in that ?
Thanks

something like this?

# uptime
 14:13:40 up 47 days, 19:37,  1 user,  load average: 0.45, 1.09, 0.75
# echo `uptime` | awk '{ print $3 " " $4 }'
47 days,

i need the total time .. i.e 47days,19:37

ya i got it
Thanks a lot :slight_smile:

on looking at the total time that system is up , i have few log files in my directory ..wat i want is depending on thheir timestmap i need to get only those files which has timestamp in the range that my system was up not before that.Can you help me on that even
For eg my present directory has :
-rw------- 1 tulip tulip 5533132 Dec 18 14:02 messages.log
-rw------- 1 tulip tulip 10405810 Dec 17 23:20 messages.log.01
-rw------- 1 tulip tulip 10278293 Dec 18 02:41 messages.log.02
-rw------- 1 tulip tulip 10414553 Dec 18 05:51 messages.log.03
-rw------- 1 tulip tulip 10406874 Dec 18 09:11 messages.log.04
-rw------- 1 tulip tulip 10229094 Dec 18 12:22 messages.log.05

and my uptime says up 17:28
hence i need only files that were created for 17hrs and 28mins ..
can someone helpme on this
this seems to be very tricky to me .. :confused:

You may find it easier to use the timestamp of a file which was created during the boot process.
On most systems the boot time can be found with:
who -b

Then look in say /etc for a suitable file.
On my unix system /etc/rc.log is timestamped at the end of the boot process and does not change. (There is much variation of the boot process across unix versions).
If the precise timestamp is important, you could create a startup script yourself to make a timestamp file at the appropriate point in the boot sequence.

Then use find with the "-newer" switch:
find // -newer timestamp_filename -type f -print