title: How can I use a command output as a input string in the command "sed -i '10istring' a.txt"
body: <p>I have 2 files.</p>
  
  <p>a.txt</p>
  
  <blockquote>
    <p>hi</p>
    
    <p>hello</p>
    
    <p>bye</p>
  </blockquote>
  
  <p>b.txt</p>
  
  <blockquote>
    <p>apple</p>
    
    <p>banana</p>
    
    <p>grape</p>
  </blockquote>
  
  <p>Every day I have to replace line 2 of a.txt to line 3 of b.txt
  So Result should be</p>
  
  <p>a.txt</p>
  
  <blockquote>
    <p>hi</p>
    
    <p>grape</p>
    
    <p>bye</p>
  </blockquote>
  
  <p><strong>The contents of both files are everyday changed by other logic
  So I cannot simply search pattern, 
  but the line# that I should replace is never changed</strong></p>
  
  <p>So far, I have got some "sed" command like below</p>
  
  <pre><code>$&gt; sed -i '2d' a.txt
  
  $&gt; sed -i '2i**grape**' a.txt
  </code></pre>
  
  <p>This command will provide me the result I want, but in the "<strong>grape</strong>" part,
  I want to use command output like this</p>
  
  <pre><code>$&gt; sed -n 3p b.txt
  </code></pre>
  
  <p>So, the pseudo command should be like</p>
  
  <pre><code>$&gt; sed -i '2i**sed -n 3p b.txt**' a.txt
  </code></pre>
  
  <p>The approach that I am thinking is possible? or Do I have a wrong approach?
  Is there any solution for this?</p>