title: Find exact word from a line and delete that line with grep/sed
body: <p>I searched few question and answers on Stack Overflow, but none of them works for my case, and I don't know why my regular expression doesn't work. I'd really appreciate if you can point out my wrong thought.</p>
  
  <p>Test case: text file contains</p>
  
  <pre><code>AllenZhou:9175186661:111th 1111 NY, 11111
  XiaoyuZhou:9175186662:2222 222th 22222 NY 22222
  Allen:1231231234:abc rd, PA
  </code></pre>
  
  <p>Here is my function:</p>
  
  <pre><code>checkEntry(){
      vaildName=true
      while read entry
      do
              if $( echo $entry | grep --quiet $name)//$name read from keyboard
              then
                      vaildName=false
              fi
      done &lt; $fileName
  }
  </code></pre>
  
  <p>If I enter <code>Zhou</code>, my function will return both <code>AllenZhou</code>, and <code>XiaoyuZhou</code>. After I did small study, I changed the grep command parameter to</p>
  
  <pre><code>if $( echo $entry | grep --quiet ^$name:$)
  </code></pre>
  
  <p>It turns out that it never finds anything for <code>AllenZhou</code> or <code>XiaoyuZhou</code> &ndash; I am confused.</p>
  
  <pre><code>sed  -i -n /$name/d $fileName
  </code></pre>
  
  <p>This is the code I use to delete lines that contains the string pattern. The problem is like with grep, if I type <code>Zhou</code> or <code>Allen</code>, the command will delete both lines that contain the keyword.  But when I change to</p>
  
  <pre><code>sed  -i -n /\&lt;$name\&gt;/d $fileName
  </code></pre>
  
  <p>it won't delete for <code>AllenZhou</code> or <code>XiaoyuZhou</code> or <code>Zhou</code>...  Again I am confused.</p>