jEdit Community - Resources for users of the jEdit Text Editor
Replace Blank Lines with a text character?
Submitted by jroy on Thursday, 8 June, 2006 - 17:45
I have been searching the archives and cannot find an answer to my question. I want to know if I can search a file and find all blank lines and replace with a text character? Then I want to be able to search all files in a directory and do the same. Is there a specific plugin I can use? Anyone have a Macro? I cannot believe that this has not already come up Smiling

Thanks,

Jery
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
I cannot believe that this ha
by thinsoldier on Fri, 16/06/2006 - 01:52
I cannot believe that this has not already come up
Neither can I.
Hi Jery, it is possible wi
by CapM on Fri, 09/06/2006 - 09:33
Hi Jery, it is possible without a plugin:
  1. Hit ctrl + f to open the search dialog.
  2. Check "[x] Keep Dialog" and "[x] Regular Expressions".
  3. Fill the Fields: "Search for:" is "^$" and "Replace with: (o) Text" is "j".
  4. Select "(o) Directory:" and fill the fields depending on you needs.
  5. Hit "Replace all"
This will replace all blank lines with the letter "j".
 
reply
by thinsoldier on Fri, 16/06/2006 - 01:51
thats not what I need tho

I need to replace all blank lines with 'nothingness'
thus deleting all blank lines

other times I need to replace any 3 blank lines back to back with just one blank line.

How do I do that?
 
regular expressions are your friend
by paulflory on Sat, 17/06/2006 - 03:14
use Find/Replace to replace all blank lines:

Find: ^\s*\n
Replace:

Note: do not type anything into the Replace field, and make sure you are using the regex option. All "empty looking" lines (i.e., 0 or more whitespace chars) ending with a newline char will be "zapped".

For reference, check out this fine book: http://www.oreilly.com/catalog/regex/

or any decent website that explains regex, such as http://en.wikipedia.org/wiki/Regular_expression


-Paul
User login
Browse archives
« March 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82339
Context Free Art (*.cfdg)   0.31   46046
JBuilder scheme   .001   18487
BBEdit scheme   1.0   18108
ColdFusion scheme   1.0   18016
R Edit Mode - extensive version   0.1   17465
Advanced HTML edit mode   1.0   16198
Matlab Edit Mode   1.0   16060
jEdit XP icons   1.0   15221
XP icons for jEdit   1.1   14285