How to delete an empty line in a text file using wse (Wisescript)
This issue has been solved. See solution.
Hi,
I have a simple text file with multiple lines. For example:
Text Line 1
Text Line 2
Text Line 3
I loop through this text file and depending on some situations, I have to delete "Text Line 2". When I do this, I want the text file to look like this:
Text Line 1
Text Line 3
and not like this:
Text Line 1
Text Line 3
What is the best way to do this? (I do not want to make back ups of the text file, etc)
Thanks!
Uma-
Backups are the only way
You cannot remove a blank line within an existing text file in any elegant manner, as far as I am aware, if you plan to use Wisescript.
The way I do this is to read each line of the text file, decide whether I need this line, and if so, write it out to another text file. When the process is complete, I delete the original text file and substitute the new text file I have written.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Thanks!
Thanks!
Would you like to reply?
Login or Register to post your comment.