cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting empty rows in Notepad

SIVA_TEJA_YADAV
Level 3
I have few empty rows in the notepad and the rows count will be close to 5000. I need to have a notepad file removing the empty rows. Please suggest me the best approach to remove the empty rows from the Notepad file   Thanks, Siva Teja
3 REPLIES 3

DaveMorris
Level 14
Hi Siva, Not sure if there's an easier way, but the below works and it's fast.   Step 1: File Management VBO - Read All Text from File Step 2: Decision stage checking this: InStr([Text],NewLine() & NewLine())>0 Step 3a: If Decision is True/Yes, replace the double NewLine characters with a single NewLine character set using this: Replace([Text],NewLine() & NewLine(),NewLine()) Step 3b: Loop back to the Decision stage Step 4: lf Decision is False/No, use File Management VBO - Write Text File to put the data back in the file without empty rows.   I tested this just now with 10k rows just in case. Dave
Dave Morris 3Ci at Southern Company Atlanta, GA

AmiBarrett
Level 12
You can also use the String.Replace method in C#, using escape characters for your blank lines. https://docs.microsoft.com/en-us/dotnet/api/system.string.replace?view=…

HemachandraSidd
Level 4
Hi,
If it is a csv file, I woul read it as a collection ( File Management VBO -> Get csv text as collection )  and use collection manipulation VBO to remove all blank rows.

------------------------------
HEMA CHANDRA RAO SIDDANI
RPA solution consultant
Amesto Account House
------------------------------