note
Biker
<P>
I understood that your need is to read a file, line by line, and if the line is not blank, write the line to the output file. Did I understand that correctly?
<BR>
<BR>
My code snippet, as you have quoted above, will:
<ul>
<li>Read one line from the input file</li>
<li>Remove a potential newline from the end of the line</li>
<li>Look if the line is now empty (zero length)</li>
<li>If empty, read next line</li>
<li>If not empty, write the line and a newline to the output file and then read next line from the input file</li>
<li>Repeat until no more lines in input file</li>
</ul>
<BR>
What part is not working as expected?
<BR>
<br>
<b>Update:</b>
<br>
I admit, I missed the words:
<br>
"<i>...specifically for finding and replacing all occurences of a string...</i>"
<br>
<br>
Of course, you're right. ;-) That's what I get for answering a question while on the run to go home. ;-)
<code>
while(<IN_FILE>)
s/from/to/g;
print OUT_FILE;
}
</code>
<br>
should do it.
<br>
<HR>
Everything went worng, just as foreseen.
</P>
168455
168455