perl -F"\|" -anlE'%x= %x?%x:(map{$_=>$i++}@F);print "$F[ $x{NAME}]|$F[$x{ZIP} ]"' junk2.txt