title: Cut and copy-paste given positions of the text
body: <p>My dummy text file (one continuous line) looks like this:  </p>
  
  <pre><code>AAChvhkfiAFAjjfkqAPPMB
  </code></pre>
  
  <p>I want to:  </p>
  
  <ol>
  <li>Delete part of the text (specific range);</li>
  <li>Copy-Paste (specific range of characters) within the file.</li>
  </ol>
  
  <p>How I am doing this:  </p>
  
  <p>To cut part of the text at wanted positions (from 5 to 7 characters &amp; from 10 to 14 characters) I use <code>cut</code>  </p>
  
  <pre><code>echo 'AAChvhkfiAFAjjfkqAPPMB' | cut --complement -c 5-7,10-14  
  AAChfifkqAPPMB
  </code></pre>
  
  <p>But I really don't know how to copy-paste text. For example: to copy text from 15 to 18 characters and paste it after character 1 (also using previous cut command). To get the final result like this:  </p>
  
  <pre><code>fkqAAAChfifkqAPPMB
  </code></pre>
  
  <p>So I do have to questions:  </p>
  
  <ol>
  <li>How to read text (from .. to) given range using perl, awk or sed &amp; paste this text at specific position.</li>
  <li>How to combine this text pasting with the previous cut command as after cutting text will move to the left side, hence wrong text will be copied.</li>
  </ol>