How to write to file in different places?
<p>I want to </p>

<ol>
<li>open file</li>
<li>add 4 underline character to beginning of line</li>
<li>find blank lines</li>
<li>replace the newline character in the blank lines with 50 underline characters</li>
<li>add new lines before and after 50 underline characters</li>
</ol>

<p>I found many similar questions in stackoverflow but I could not combine all these operations without getting errors. <a href="http://stackoverflow.com/questions/7844477/how-to-turn-newlines-in-a-file-to-lines-extending-to-end-of-line">See my previous question here</a>. Is there a simple beginners way to accomplish this so that I can start from there? (I don't mind writing to the same file; there is no need to open two files) Thanks.</p>
