| User: editor -- 2008-05-30 << 165 167 >> |
| Hits: 478 |
| Type: Advanced search and replace |
| Search all Advanced search and replace examples |
| Description: |
| How to join groups of lines together in a text file according to user defined rule? |
| Input Sample: |
| [item1] line1 line2 line3 [item2] line21 line22 [item3] line31 line32 line33 |
| Output Sample: |
| [item1] line1 line2 line3 [item2] line21 line22 [item3] line31 line32 line33 |
| Answer: |
| Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
| It's easy to use replace pioneer, just need to remove the line break which is not followed by a '['. 1. ctrl-o open source file. 2. ctrl-h open 'Replace' dialog, in 'Replace' window, * fill in 'Search for Pattern': Note: \n+ means any of consecutive line breaks * fill on space character in 'Replace with Pattern': * fill the window under 'If': Note: means the matched \n+ not followed by a '[' 3. click 'Replace', finish. Above operation means if a line is not followed by a '[' in next line, replace the line break with one space character. |
| Download Script: scripts/166.rst.zip |
Screenshot 1: Replace_Window |
Similar Examples: |
| How to sort the lines in a text files by the order of line length? (62%) How to change text file format with user specified rules? (60%) How to split a text file according to first word in each line? (58%) How to convert the text format by user specified rules? (58%) How to sort lines of text file by comparing the sum of column1, 2 and 3? (55%) How to join hundreds of columns in different files into one csv file? (55%) How to sort all the lines of a text file by order the multiple columns? (55%) How to join every n lines into 1 line in a text file? (55%) |
Check Demo of Advanced search and replace |
| Keywords: |
| consecutive onsecutive not followed break together line break cut next line group define remove consecutive space replace remove line break remove break search next search and replace not followed by remove lines text pioneer replace pioneer remove lines remove one space |