Bash - Search and append strings <p>If I wanted to search for a line in a file and append a string to the end of that line, how can I go about it? I.E.:</p> <pre><code>file=? </code></pre> <p>I want to search for <code>file=?</code> and replace the question mark with a file path. The file path is located in a variable <code>$FILEPATH</code></p> <pre><code>file=$FILEPATH </code></pre> <p>Thanks!</p> <p>EDIT</p> <pre><code>sed -i -f "s,file=\?,file=$FILEPATH,g" </code></pre> <p>The above works well and is what I'm looking for but is there a way to replace the question mark? With the code above if I have the following:</p> <pre><code>FILEPATH=/file/path </code></pre> <p>Properties file:</p> <pre><code>something=? file=? </code></pre> <p>The replacement produces:</p> <p>Properties file:</p> <pre><code>something=? file=/file/path? </code></pre> <p>Is there a way to replace the <code>?</code> completely?</p>