title: Add certain strings to the front of given lines
body: <p>I have two input files: <br/></p>
  <p>input1 is the file I need to process, input1 file example: <br/></p>
  <pre><code>efgdx
  efgfx
  aa
  efgdx
  b
  efgdx
  </code></pre>
  <p>input2 file tells what characters need to be add to which line, for example: <br/></p>
  <pre><code>2,abcd
  4,efg
  5,hij
  </code></pre>
  <p>So, &quot;abcd&quot; should be added to the front of 2nd line, &quot;efg&quot; should be added to the front of 4th line, ...</p>
  <p>This is the output I want: <br/></p>
  <pre><code>efgdx
  abcdefgfx
  aa
  efgefgdx
  hijb
  efgdx     
  </code></pre>
  <p>I tried the following code but it will add strings to every line <br/></p>
  <pre><code>awk '!p { getline m &lt; &quot;input2&quot;; split(m, a, &quot;,&quot;); p = 1} NR == a[1] {p=0} 1 { print a[2] $0}' input1
  </code></pre>
  <p>output from above code:<br/></p>
  <pre><code>abcdefgdx
  abcdefgfx
  efgaa
  efgefgdx
  hijb
  hijefgdx
  </code></pre>
  <p>Thanks very much for your inputs!</p>