LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-29-2009, 07:20 AM   #1
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,274

Rep: Reputation: 148Reputation: 148
grep the used memory from free command ouput


Code:
# free -m -s 1 | grep Mem 
Mem:          4051       2303       1747          0        611       1418
Mem:          4051       2303       1747          0        611       1418
Mem:          4051       2303       1747          0        611       1418
Mem:          4051       2303       1747          0        611       1418
Mem:          4051       2303       1747          0        611       1418
Mem:          4051       2303       1747          0        611       1418
Mem:          4051       2303       1747          0        611       1418
From the above output i have to filter third column(actually that is a used memory), how can i filter hird column using another pipe and awk or sed, please anybody help me to do this filter.

Thanks
 
Old 06-29-2009, 07:27 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Code:
free -m -s 1 | grep --line-buffered Mem | awk '{print $3}'
 
Old 06-29-2009, 08:34 AM   #3
ghostdog74
Senior Member
 
Registered: Aug 2006
Posts: 2,697
Blog Entries: 5

Rep: Reputation: 244Reputation: 244Reputation: 244
Code:
free -m -s 1 | awk '/Mem/{print $3}'
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Memory leak: How risky not to free allocated memory. kaz2100 Linux - General 1 12-24-2008 12:00 AM
Help me in Grep Command + cd command in single line JeiPrakash Linux - Newbie 3 05-27-2008 04:16 AM
Refreshing RAM -- software or command? Trying to free up memory hyphae Slackware 26 03-10-2007 05:11 AM
set the ouput of a command to a variable true_atlantis Linux - Newbie 2 03-23-2006 03:30 PM
"Undeleting" data using grep, but get "grep: memory exhausted" error SammyK Linux - Software 2 03-13-2004 03:11 PM


All times are GMT -5. The time now is 12:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration