Skip to content
Advertisement

free -g with sed -n plus nth character

I am trying to create a script to display just one of the numbers from the free command. In my case, the number I want is on the 2nd line of the free -g output and at character slot 43. The original output of free -g is:

JavaScript

So far I have gotten the 2nd line to display with:

JavaScript

I need just the 43rd character of that line or the 4th column? I have looked into printf and cut but get a grody syntax error.

Advertisement

Answer

If a line contains Mem: print from this line column 4:

JavaScript

Output:

2
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement