Unix row to column format with string prefix and post fix
<p>I have the requirement to convert row string data to column format and pre/postfix specific strings. The data string in file has 4 major fixed columns (separated by &quot;;&quot;) and each column is further divided in two sections (separated by &quot;:&quot;).</p>
<p>E.g.</p>
<p>Source data file:</p>
<pre><code>A100:T100;B100:T200;A200:T300;B200:T400
</code></pre>
<p>Output from file should be:</p>
<pre><code>TABa:BatchID=A100:TagId=T100:ProcId=1
TABb:BatchID=B100:TagId=T200:ProcId=2
TABc:BatchID=A200:TagId=T300:ProcId=3
TABd:BatchID=B200:TagId=T400:ProcId=4
</code></pre>
<p>Meanwhile I am trying with following code:</p>
<pre><code>String=&quot;A100:T100;B100:T200;A200:T300;B200:T400&quot;

&gt; File.txt
for deploy in $(echo $String | tr &quot;;&quot; &quot;\n&quot;)
do
   echo $deploy &gt;&gt; File.txt
done

cat File.txt | awk 'BEGIN { FS=&quot;:&quot;; OFS=&quot;:&quot; } NR==1{ print &quot;TABa:BatchID=&quot;$1,$2 } NR==2{ print &quot;TABb:BatchID=&quot;$1,$2 }'
</code></pre>