title: Remove line from file in bash script using sed command
body: <p>I am trying to remove lines from a text file from a Bash Script using command sed.  </p>
  
  <p>Here is how this function works.<br>
  User enters record number
  Program Searches for record number 
  Program deletes record </p>
  
  <p>Here is my code: </p>
  
  <pre><code>r=$(grep -h "$record"  student_records.txt|cut -d"," -f1)  #find the record that needs to be deleted
  echo $line --&gt;&gt; This proves that previous command works
  sed -i '/^$r/d' student_records.txt  --&gt;&gt; this does not work
  </code></pre>
  
  <p>Any ideas?</p>