Coloque isso em um script.sh e execute ./ script.sh primeiro segundo
#!/bin/bash
TOFIND=($(cat "$1" | tail -n +2))
COLUMNS=()
for ((I=0; I<3; ++I))
do
COLUMNS+=("$(cat "$2" | tail -n +3 | awk -F' ' '{print $'$((2*$I+1))',$'$((2*$I+2))'}')")
done
RESULT=()
echo -e "\tNP\tNT\tCT"
for ELEM in "${TOFIND[@]}"
do
echo -ne "$ELEM"
for COLUMN in "${COLUMNS[@]}"
do
VAL="$(echo "$COLUMN" | grep "$ELEM")"
if test -z "$VAL"
then
VAL=0
else
VAL="$(echo "$VAL" | awk -F' ' '{print $2}')"
fi
echo -ne "\t$VAL"
done
echo ""
done