title: Shell Script : How to add in the end of lines which contains special string
body: <p>I have a VAR which contain : </p>
  
  <pre><code>list_data="toto
  titi
  tata
  tete"
  </code></pre>
  
  <p>My array can contain like this example or more values then 3 data :</p>
  
  <pre><code>arraytest[0]="Hello|Test|env|tata|POLO|GER|GO|"
  arraytest[1]="GOODNIGHT|Test2|env2|tete|GOLF|ITA|NOTGO|"
  arraytest[2]="AFTER|Test3|env3|JAJA|CIT|FRA|GO|"
  </code></pre>
  
  <p>and my string is </p>
  
  <pre><code>string="INSERT"
  </code></pre>
  
  <p>What I want to do is to add special string in the end of each line where every line contain each value of list_data</p>
  
  <p>For example :</p>
  
  <pre><code>arraytest[0]="Hello|Test|env|tata|POLO|GER|GO|INSERT"
  arraytest[1]="GOODNIGHT|Test2|env2|tete|GOLF|ITA|NOTGO|INSERT"
  arraytest[2]="AFTER|Test3|env3|JAJA|CIT|FRA|GO|"
  </code></pre>
  
  <p>I try this </p>
  
  <pre><code>echo ${arraytest[*]} | sed -i 's/$/ $string'
  </code></pre>
  
  <p>Please Help.
  Thank you.</p>