diffmeminfo.awk (Source)

#!/usr/bin/awk -f
#
# Script    : diffmeminfo.awk
# Copyright : (c) 2017 Carsten Grohmann
# Licence   : MIT - THIS PROGRAM COMES WITH NO WARRANTY
# Homepage  : https://www.carstengrohmann.de
#
# Edit History:
#  2017-06-16: Initial version

# print headline
BEGIN{
  printf("%18s %12s %12s %12s\n", "Name", "old", "new", "new - old")
}

# FNR is the line number in the current file
# NR is the overall line number
# Thereby
#  FNR == NR: first file
#  FNR != NR: second, third, ... file
{
  if(NR == FNR){        # first file
    n[$1] = $2;
    next;
  }else{                # second file
    printf("%18s %12d %12d %12d\n", $1, n[$1], $2, $2 - n[$1])
  }
}