how to get the last line of an output
I want to write a bash script to run a command and get the last line of the output of that command.
For example, the output of "cat /proc/zoneinfo" is: Code:
Node 0, zone DMA |
To get the last line, you can use
tail -n 1 /proc/zoneinfo See the man page for tail for more details. What do you mean by "separated format"? |
Code:
tail -1 /proc/zoneinfo |
Thanks. it was useful
|
On a side note, proc files can change. If you know what you really need from it, grep for the pattern you wish to grab.
grep inactive_ratio /proc/zoneinfo |
All times are GMT -5. The time now is 01:23 AM. |