Removal of Blank Lines

Tool for Search and Replace across multiple files.
Post Reply
msharpe
Posts: 2
Joined: Mon Apr 20, 2015 9:07 pm

Removal of Blank Lines

Post by msharpe »

Hi,

Here is the problem.

I thought I had successfully formatted multiple files, and they show up as required when opened in notepad and textcrawler.

But, when opened in wordpad there are some blank lines that should not be there.

The following was copied from a txt doc and did not show the blank lines until pasted into this message !

This is machine tool programming code and I have several thousand files to modify.

%
O5041
(MSO2 036)
(FAST)
(FEEDRATE 250)
G82P1500Q500R100F250.0
G88P18M56
G87P0

M32
M22

G181R35
M99
%

How do I remove these blank lines ? I have tried the regular expression ^\r\n and replace with nothing, but this does not find anything to replace.

Thanks

Michael.
User avatar
DigitalVolcano
Site Admin
Posts: 1724
Joined: Thu Jun 09, 2011 10:04 am

Re: Removal of Blank Lines

Post by DigitalVolcano »

To use

Code: Select all

^\r\n
you need the option 'Multi line anchors' enabled.

Also, this assumes you don't just have \r or \n line endings!
ramstutz
Posts: 1
Joined: Wed Jan 16, 2013 6:08 pm

Re: Removal of Blank Lines

Post by ramstutz »

Can you clarify? I have the same situation.. I use the ^\r\n in the Regex along with the Multi-Line anchors but it doesn't find anything. What should I replace it with?
Ultimately, I am wanting to remove the 1st line in the program. The first line is the program filename. I can find that using a REGEX, but can only figure out how replace with 'nothing'....how do I delete the blank line or find with a REGEX and delete that line?

1. Find the first line $xxxxxx.MIN%
2. Delete Line

Sample:
$O22880.MIN%
O5000
N5 (O22880.MIN)
N10 (2504-01)

Final Output
O5000
N5 (O22880.MIN)
N10 (2504-01)
Post Reply