Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

534.Advanced search and replace -- How to join the specified 2 or 3 lines together alternatively in a text file?

User: editor -- 2010-06-13          << 533  535 >>
Hits: 371
Type: Advanced search and replace   
Search all Advanced search and replace examples
Description:
How to join the specified 2 or 3 lines together repeatly in a text file?
I need to join lines with following rules:
line1+line2,
line3+line4+line5,
line6+lihe7,
line8+line9+line10,
line11+line12,
line13+line14+line15
...
Input Sample:
line1
line2
line3
line4
line5
line6
line7
line8
line9
line10
...
Output Sample:
line1 line2
line3 line4 line5
line6 line7
line8 line9 line10
...
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
To join lines with 2 or 3 lines alternatively, means remove the "new line(\n)" characters of line 1,3,4, 6,8,9, 11,13,14, ... (or 1,1+5,1+10, ..., 3,3+5,3+10, ... 4,4+5,4+10, ...)

1. ctrl-o open source text files
2. ctrl-h open replace dialog
* set "unit number filter" to:

* in "search for pattern" enter \n as newline:

* in "replace with pattern" enter \t as line separator:

3. click "Replace", done!
Download Script:  scripts/534.rst.zip

Similar Examples:
How to list all specific terms that appearing in a text file? (61%)
How to shuffle specified lines in multiple text files? (60%)
How to exract specified strings started with www from text file? (60%)
How to batch extract specified lines from a text file? (58%)
How to replace or remove 3 lines randomly in a text file? (56%)
How to extract multiple lines in specified order from many text files? (56%)
How to extract all specified date format from a text file? (56%)
How to insert a line after specific lines in a text file? (56%)

Check Demo of Advanced search and replace
Keywords:
repeat  newline  together  join lines  rules  join line  unit number filter  number filter  para  join  remove new line  remove specified  join 2 lines  lines join  lines to new file  remove characters  join 3 line  join 2 line