I am trying to make a very simple shell script that frees up some memory space. For this, I am using command
$ ps xopmem o%c
to output a list of running processes with its percentual memory usage. Now, I want to filter out only those lines whose value (in the first field) is larger than, say 5.0. How can I do that? I preferably use SED.
P.S.: I Googled around this topic on the Internet but found nothing. Any help will be appreciated.
sedcannot do numerical comparisons, you need to move one tool up, i.e.awk:That is, when the first field is greater than 5, execute the default block:
{ print $0 }.