Page 1 of 1
delete excessive blank lines...
Posted: Mon Sep 11, 2006 2:17 am
by agent86
I have documents that contain 2 blank lines in a row. When it occurs, I would like to erase the second blank line.
For example:
Now is the time
for all good men to...
**becomes**
Now is the time
for all good men to...
Posted: Mon Sep 11, 2006 4:56 am
by Bob Hansen
Search for: \n\n
Replace with \n
Need checkmark in box to Use Regular Expressions
great. that works, but how...
Posted: Mon Sep 11, 2006 8:41 pm
by agent86
I now see there are lines with just spaces in them from 2-4, maybe more. What do I do if the adjacent lines just have spaces. It appears to be 2 blank lines in a row but there are only spaces. Can it verify if there are spaces only and remove the second line?
For example:
Now is the time for all good men
[space][space]
[space][space]space][space]
to come to the aid of the party
***becomes***
Now is the time for all good men
[space][space]
to come to the aid of the party
Posted: Mon Sep 11, 2006 8:58 pm
by Bob Hansen
Your words are not matching your example. Your words say to remove the second line, but the example removes the first line.
The following will remove all Space, tab, vertical tab, return, line feed, form feed that start the line and continue/mix till the end of the line. This takes care of all white space and just leaves a return
Search for:^[[:space:]]*\n^[[:space:]]*\n
Replace with: \n
So that this:
Now is the time for all good men
[space][space]
[space][space]space][space]
to come to the aid of the party
***becomes***
Now is the time for all good men
to come to the aid of the party
=========================
If you really want the "blank" line to have two spaces then insert two spaces in front of the \n that is mentioned above.
Replace with " \n"