Advanced Search and Replace

replace_demo  Replace_text_in_multiple_files 
Advanced Search and Replace Features:
* Supports regular expression and multiple line search and replace
* Can search and replace text in multiple files
* Can add,delete,insert text or cut and reorganize the matched strings
* Can apply variables like "line_no" or "word_no" on the matched strings
* Can apply functions like "reverse","uc(uppercase)","sort" on the matched strings
* Can replace whole word,line or paragraph that containing searched strings
* Can make multiple search and replace in one time by providing multiple rules
* Every operation is automatically recorded into script, can modify and re-use

Column Exchange - Advanced Search and Replace

Example

Reverse order the 2,3,4,5 words of each line.

Advanced search and replace

Procedures:

1) ctrl-o open source text file

2) ctrl-h open 'replace' dialog

3) set 'Replace Unit' to 'Line'

4) set 'Replace with pattern' to '$match[1,5,4,3,2,6..]'

5) click 'Replace', the column 1,2,3,4,5,6 will be changed to 1,5,4,3,2,6


Line Merge - Advanced Search and Replace

Example

Join every 3 lines into one line

Advanced search and replace

Procedures:

1) ctrl-o open source text file

2) ctrl-h open 'replace' dialog

3) set 'Unit number filter' to '!3<3>'

4) set 'Search for pattern' to '\n'(\n means newline)

5) set 'Replace with pattern' to nothing

6) click 'Replace', all line breaks except 3,6,9,12,... will be removed

Notes:

3<3> means 3,6,9,12,...(start from 3, step is 3).

!3<3> means 1,2,4,5,7,8,10,11,(not 3,6,9,12,15,...)

Advanced Text Sort - Advanced Search and Replace

Example

Sort all lines by the value of second word

Procedures:

1) ctrl-o open source text file

2) ctrl-h open 'replace' dialog

3) set 'Replace with pattern' to "sort_by_word($match,2,2,'num')"

4) click 'Replace', all lines will be sorted by the value of second word

Example

Sort all words by the length

Procedures:

1) ctrl-o open source text file

2) ctrl-h open 'replace' dialog

3) set 'Replace with pattern' to "join(' ',sort { length($a)<=>length($b) } split(' ',$match))"

4) click 'Replace', the text will be sorted by the value of second word

Notes:

For batch replace files, please refer to Replace Pioneer help manual.


Other Examples of "Advanced search and replace"
How to copy one file to create multiple duplicate files?
How to delete the last 3 words only if the first line has 8 words or more?
How to replace the same words in text files with different strings?
How to remove everything from start of line to the first comma in each line?
How to add a page number after every 40 lines in a text file?
How to add first line to the start of each line?
How to remove all lines that contain one or more words in a list?
How to use many replace pioneer script file(rst) on one input file?

Search all "Advanced search and replace" examples