this awk should be rewritten for clarity  i prefer the following  but i understand it is open to subjective opinion  also  there is a spurious second in the middle block  awk  v v entries heat hosts start print print v f f heat hosts end next heat hosts end  f f file  file temp