title: Changing a line in a text file if it exists
body: <p>I know you can change a line in a text file using sed in bash that shows something like;</p>
  
  <p>name="applicationname" //this is not the issue (it varies, thats why i use a var)</p>
  
  <p>Depiction: <a href="http://google.com" rel="nofollow">http://google.com</a> 
  or 
  Depiction: <a href="http://yahoo.com" rel="nofollow">http://yahoo.com</a> //some times the 'value' in depiction varies</p>
  
  <p>to</p>
  
  <p>Depiction: <a href="http://mysite.com/depiction.php?package=applicationname" rel="nofollow">http://mysite.com/depiction.php?package=applicationname</a> //this is the format i would like to achieve</p>
  
  <p>by using sed, but I'm not entirely sure how to implement sed.
  <a href="http://www.gnu.org/software/sed/" rel="nofollow">http://www.gnu.org/software/sed/</a></p>
  
  <p>EDIT: This is what i just came up with</p>
  
  <pre><code>sed -i "s!Depiction:.*!Depiction: http://mysite.com/depiction.php?package=$name!" ./inputfile
  </code></pre>
  
  <p>What if in this particular text file, there isnt a 'Depiction:'?
  how do i insert a line: Depiction: <a href="http://mysite.com/depiction.php?package=applicationname" rel="nofollow">http://mysite.com/depiction.php?package=applicationname</a> ?</p>