cut
Last modified: December 2, 2006
The cut command has the ability to cut out characters or fields. cut uses delimiters.
The cut command uses delimiters to determine where to split fields, so the first thing we need to understand about cut is how it determines what its delimiters are. By default, cut’s delimiters are stored in a shell variable called IFS (Input Field Separators).
Changing the delim to a comma:
cut -d ","
The cut command lets one cut on the number of characters or on the number of fields. Since we’re only interested in fields 2,3 and 4 of our memory, we can extract these using:
free | tr -s ' ' | sed '/^Mem/!d' | cut -d" " -f2-4
References:


Recent Comments