Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

393.Regular expression replace -- How to change text file format with user specified rules?

User: wenbo -- 2010-01-15
Hits: 134
Type: Regular expression replace   
Search all Regular expression replace examples
Description:
How I can exchange the special pattern characters to the most following another special pattern ?
Input Sample:
"A/G"
CGGCAGAGAA CAGGTYASCC ACCACTATGC
R
CAGGTTCTCA TCATTGAAGC TGCTCTCAGG
"C/G"
TATGGGCCCG CGTGGCGCGA GCAGAGGCGC
TTCTCCGT
S
TCCACCTTGC GCAACTTGGG CCTGGGCAAG
AAGTCGCTGG

Output Sample:
CGGCAGAGAA CAGGTYASCC ACCACTATGC
[A/G]
CAGGTTCTCA TCATTGAAGC TGCTCTCAGG
TATGGGCCCG CGTGGCGCGA GCAGAGGCGC
TTCTCCGT
[C/G]
TCCACCTTGC GCAACTTGGG CCTGGGCAAG
AAGTCGCTGG
Answer:
Hint: You need to Download and install "Replace Pioneer" to finish following steps.
Assume you want to change following format:

"X/Y"
************************
****************
*

with following format:
************************
****************
[X/Y]

Procedures:
1. ctrl-o open source text file
2. ctrl-h open 'replace' dialog
* in "search for pattern", enter:

* in "replace with pattern", enter:

3. Click 'Replace', done
4. Ctrl-s save to file
Download Script:  scripts/393.rst.zip

Similar Examples:
How to convert the text format by user specified rules? (86%)
How to parse data from the text file and create text with  user specified format? (67%)
How to split a large text file into specified various number of lines? (62%)
How to change text file with hexidecimal format into original binary file? (62%)
How to search and replace text 'ReplaceMe' only in specified lines? (61%)
How to batch change format of multiple files? (60%)
How to change all numbers in a text file to the comma separated numbers? (60%)
How to join groups of lines together in a text file according to user defined  rule? (60%)

Check Demo of Regular expression replace