echo "Enter the PID :" read pid linenum=`cat tes.txt | tr -s " " "|" | cut -d"|" -f2 |grep -n $pid` cat tes.txt | head -$linenum | tail -1