while read inputline do REL_TYPE=`echo $inputline | cut -f4 -d"|"` if [ $REL_TYPE == "E" ]; then EMP_NO=`echo $inputline | cut -f3 -d"|"` fi if [ $REL_TYPE == "C" ]; then echo $EMP_NO"|"$REL_TYPE fi done < $1 exit 0