Search name and display column from a file

Hi I have search everywhere for this but I haven't got any result. so here is my question?
I am trying to ask user to enter a name and then searching that name from a file and from a specific column. If user enter something, it should only displaying that name from that specific column and If the user enters quit, then program should quit. I am really having trouble with this. Any help will be appreciate.

echo "Name:"

while read name
do
        if  [ $name=0 ]
      then
          echo $name < filename
          cut -c 5-19 filename
           #echo "name is $name."
        elif [ $name = "Quit" ]
        then 
     exit       
fi
done

Change the if loop to first check the Quit condition else it goes to get the content from the file

Oh thanks but do you know how to write IF statement to find name? I am just going crazy :frowning:

If your requirement is to find a name in the file as a success condition then you can try this

while read name
do
        #if [ `echo $name < abc.txt` ]
        if [ `grep $name abc.txt` ]
        then
                echo "$name matches \n"
        elif [ $name = "Quit" ]
        then
                exit;
        fi
done

Also if a name does not match and you have some action intended for that as well then add an else loop

HTH,
PL