formating console output (omitting parts you do not want)
So there is uptime, which gives me a format like this:
Code:
12:28:51 up 22:29, 4 users, load average: 0.05, 0.04, 0.01 Code:
up 22:29 Now... How do I format it in such a day that it can pick up only the uptime.... when it can range from what you see above to Code:
up 12 days I need a solution that will work both on various GNU/Linux distros AND BSD's |
Code:
uptime | cut -d ',' -f 1 | sed -e "s/.*up/up/" |
wanna make out?
thanks! |
Glad it worked out for you. cut and sed can be very userful.
|
I knew there was something like cut, and sed and awk are *vey* useful. I'll admit tho that I need to learn more about these. I have some uncomitted time this weekend that I'll put towards learning more about these tools.
Something like doing a df -h and adding up the net total of disk space would be nice. These tools should help accomplish that. thanks for the help. |
This may be slightly OT but if you are interesting in being able to tell at a glance what your uptime is, along with a lot of other useful stats, check out gkrellm. http://web.wt.net/~billw/gkrellm/gkrellm.html It's totally cool and gives you a central, graphical way to keep tabs on your system. -- J.W.
|
I don't run X on servers ;) but thanks for the suggestion.
torsmo is also a *very* nice app. I find it's interface much more appealing. |
All times are GMT -5. The time now is 01:52 AM. |