title: Commenting out lines in a file using a bash script
body: <p>I am trying to modify a certain file on my linux machine in a script. The file is the /etc/pam.d/login file. The issue is that the contents of the file are, </p>
  
  <pre><code># Prints the message of the day upon succesful login. 
  # (Replaces the `MOTD_FILE' option in login.defs)
  # This includes a dynamically generated part from /run/motd.dynamic
  # and a static (admin-editable) part from /etc/motd.
  session    optional   pam_motd.so  motd=/run/motd.dynamic noupdate
  session    optional   pam_motd.so
  </code></pre>
  
  <p>And I need to comment out the second session line in this file but when I go to string match the result is as follows (I am using SED to do so for those interested).</p>
  
  <pre><code># Prints the message of the day upon succesful login.
  # (Replaces the `MOTD_FILE' option in login.defs)
  # This includes a dynamically generated part from /run/motd.dynamic
  # and a static (admin-editable) part from /etc/motd.
  #session    optional   pam_motd.so  motd=/run/motd.dynamic noupdate
  #session    optional   pam_motd.so
  </code></pre>
  
  <p>Because the first line matches the condition as well. How would I make sure that the whole line matches "session    optional   pam_motd.so" and not just a certain part of it.</p>
  
  <p>Thanks!</p>