title: awk bash repeat pattern
body: <p>I currently have this ORIGINAL string:</p>
  
  <pre><code>mklink .\Oracle\MOLT_HYB_01\110_Header\pkg_cdc_util.pks $.\Oracle\MOLT_HYB_01\110_Header\pkg_cdc_util.pks
  #.......................................................^
  </code></pre>
  
  <p>....and need to replace as follows:</p>
  
  <pre><code>mklink .\Oracle\MOLT_HYB_01\110_Header\pkg_cdc_util.pks ..\..\..\..\.\Oracle\MOLT_HYB_01\110_Header\pkg_cdc_util.pks
  #.......^......^...........^..........^.................^^^^^^^^^^^^
  </code></pre>
  
  <p>i.e. replace <strong>$</strong> with "..\" 4 times based on the number of slashes in the 2nd column of the ORIGINAL string (".\Oracle\MOLT_HYB_01\110_Header\pkg_cdc_util.pks")</p>
  
  <p>I can for example do the following individually:</p>
  
  <ol>
  <li><code>awk -F '\\' '{print NF-1}'</code> --> to print the number of occurrences of the backward slash</li>
  <li><code>sed -e "s,\\\,$(printf '..\\\%.0s' {1..4}),g"</code> --> to replace and repeat the string pattern</li>
  </ol>
  
  <p>......but unsure how to string together in 1 command line.</p>