Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1187.Advanced search and replace -- How to convert pipe separated elements in each line to specified format?

User: Aaron -- 2014-03-23          << 1186  1188 >>
Hits: 1547
Type: Advanced search and replace   
Search all Advanced search and replace examples
I would like to convert text files containing pipe "|" delimited lines into the format for importing into Replace Pioneer's Fast Replace window.

I've included an option request to choose a random word from the matching <replace> line if that's possible.
Option: For every FIRST word or pharse in pipe delimited line choose a random word or phrase from the same line and replace in output text
For every
Input Sample:
 FIRST word or phrase|SECOND word|THIRD word|FOURTH word|FIFTH word|SIXTH word
 Another first word|another second word|another third word|another fourth word|another fifth word|another sixth word

Output Sample:
<find>FIRST word or phrase</find>
<replace>{SECOND word|THIRD word|FOURTH word|FIFTH word|SIXTH word}</replace>
<find>Another first word</find>
<replace>{another second word|another third word|another fourth word|another fifth word|another sixth word}</replace>


Note: Brackets { and } are added 


<find>FIRST word or phrase</find>
<replace>rand_str_unique(1,'SECOND word','THIRD word','FOURTH word','FIFTH word','SIXTH word')</replace>
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open text file
2. ctrl-h open 'replace' dialogue
* set 'replace unit' to 'Chars'
* set 'replace scope' to 'Line'
* set 'search for pattern' to:

* set 'replace with pattern' to:

3. click 'replace', done.
4. ctrl-s save to file.

For the option, just need to change 'replace with pattern' entry in step 2:

Screenshot 1:  Replace_Window

Similar Examples:
How to convert a text file to specified format? (69%)
How to change each line into specified format? (65%)
How to change each line of data to the specified format? (64%)
How to decorate each of marching number with specified format? (63%)
How to change columns in each line to specified order in text file? (62%)
How to convert each line of a text file to the new format? (61%)
How to convert the text from hex format to ascii format? (59%)
How to remove the first 10 characters of each line in text file? (57%)

Check Demo of Advanced search and replace
matching  delimited  chin  include  specified format  phrase  unique  separate  random word  random wor  matching lines  line matching  find lines containing in word  format text into lines  same phrase  replace random every  split line containing  join every lines into line