- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Triming characters from output
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2003 04:46 AM
05-15-2003 04:46 AM
Triming characters from output
I am using the following command to get total memory:
# top -n 1 | grep Mem | awk '{print $2}'
I get the following output:
126112K
How do I further trim this output to get rid of the K so that I can use this number in a calculation.
Thanks,
Trystan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2003 05:18 AM
05-15-2003 05:18 AM
Re: Triming characters from output
# top -n 1 | grep Mem | awk '{print $2*1024}'
?
It works...
J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2003 06:36 AM
05-15-2003 06:36 AM
Re: Triming characters from output
Regards,
Sergejs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2003 07:22 AM
05-15-2003 07:22 AM
Re: Triming characters from output
you can find the file
/proc/meminfo
more useful.
$ cat /proc/meminfo | grep MemTotal | awk '{print $2}'
512596
it's even faster than using top.
hope this helps,
Claudio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2003 09:06 AM
05-15-2003 09:06 AM
Re: Triming characters from output
cat /proc/meminfo | grep ^Mem: | awk '{print $2}'