title: Replace part of lines of a file that match a string in Bash
body: <p>Here is what I'd like to do:</p>
  
  <p>I have a file which is space delimited, and I have an array of integers. I need to search each line of the file (inv.txt) for each element in the array. If the pattern is found, I need to retain the first 7 characters of the line and replace the rest with "     0;     0;"</p>
  
  <p>I'm very new to scripting and what I've tried so far is this: (I think I've gotten a little off track)</p>
  
  <pre><code>removing=(3199 26543)
  for line in inv.txt
  do
     for i in "${#removing[@]}"
     do
         sed -i "s/${removing[$1]/c\ ${line:0,7}      0;      0;/g inv.txt
     done
  done
  </code></pre>
  
  <p>This gave me a sed -e expression #1 char 0: no previous regular expression
  I doubt this is the best way to accomplish the task (if it even will)...Any help is appreciated, thanks in advance! </p>
  
  <p>Edit: I'm using an array because it will actually contain a couple thousand entries! The two I put in it for this scenario is just for testing.</p>