It has been a long time and I am not really into advanced filtering output of Linux commands with grep, awk and other tools.
What I want to do is filter out used and free RAM of free -m.
My command so far: free -m | grep - | awk -F : '{print $2}'
Output example: 14 1009
14 is used and 1009 is free.
Now I need to split this output into two commands so one gives out the used amount and the other the free amount.
Been trying stuff with cut and so on but the problem is that the example output is $2 in whole so the whole thing gets cut out and the output is empty. Not that it would have been easier if free -m would have put $2 in for used and $3 for free...
So how do change my filter command into two different to filter out the amount of used and free memory?
http://ift.tt/1dvHQ0Z
0 comments:
Post a Comment