title: Shell/Bash parsing text file
body: <p>I have this text file, which looks like this</p>
  
  <pre><code>Item:
  SubItem01
  SubItem02
  SubItem03
  Item2:
  SubItem0201
  SubItem0202
  Item3:
  SubItem0301
  ...etc...
  </code></pre>
  
  <p>And I need is to get it to look like this:</p>
  
  <pre><code>Item=&gt;SubItem01
  Item=&gt;SubItem02
  Item=&gt;SubItem03
  Item2=&gt;SubItem0201
  Item2=&gt;SubItem0202
  Item3=&gt;SubItem0301
  </code></pre>
  
  <p>I am aware of the fact, that I need two for loops to get this. I did some tests, but... well, it didn't end up well.</p>
  
  <pre><code>for(( c=1; c&lt;=lineCount; c++ ))
  do
  
     var=`sed -n "${c}p" TMPFILE`
     echo "$var"
  
     if [[ "$var" == *:* ]];
     then
     printf "%s-&gt;" $var
     else
     printf "%s\n"
     fi
  done
  </code></pre>
  
  <p>Could anyone please kick me back on the road? I tried bunch of variete ways, but I am not getting anywhere. Thanks.</p>