Check if the line begins with mem, swap or total and ignore any line that doesn't.
Use split(" +") to break each line into columns.
Extract the data from the relevant columns.