SED command: How -i and -e work
<p>I'm using the sed command for the first time to try and replace one file with another file in a txt/fsf file. Can somebody help me understand how -i and -e work here? </p>

<p>With my code, I am iterating through various folders and copying and exsisting file to each folder and renaming the title. 
It seems that when I omit the -e, then I get errors at the sed command doesn't work. However, with this current code, the cp command is working just fine until I added the sed line. Now the cp command is outputting two files per folder ${i}_design.fsf and ${i}_design.fsf-e</p>

<p>I am not sure what the -e file is. The file seems to be identical to the original design.fsf file.  Is this related to the sed command?</p>

<pre><code>#!/bin/sh
# 
Folders=(CONTROL GROUP1 GROUP2)
SC=(CPAKS_02 CPAKS_03 CPAKS_04 CPAKS_05 CPAKS_06 CPAKS_07) 
data_source=/Users/sheena/Desktop/test

cd ${data_source}

for j in ${Folders[@]}; do
  for i in ${SC[@]}; do
    cd ${data_source}/${j}/${i}
    cp ${data_source}/design.fsf ${data_source}/${j}/${i}/${i}_design.fsf
      for k in ${i}_design.fsf; do
        sed -i -e 's,'/Users/sheena/Desktop/DTI/CPAKS_03/fmri','${data_source}/${j}/${i}/${i}_fmri.nii',' ${i}_design.fsf
      done  
  done
done
</code></pre>