Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

356.Text file parser -- How to parse data from the text file and create text with user specified format?

User: editor -- 2009-10-26          << 355  357 >>
Hits: 4696
Type: Text file parser   
Search all Text file parser examples
Description:
How to change the text file to user specified format?
Input Sample:
:FULLY-SPECIFIED 
:DEGREES 

root -1.1 1.2 1.3 1.4 1.5 1.6 
mashen01  
mashen02 
majian 

root -2.1 2.2 2.3 2.4 2.5 2.6 
mashen01  
mashen02 
majian 

root -3.1 3.2 3.3 3.4 3.5 3.6 
mashen01  
mashen02 
majian 

root -4.1 4.2 4.3 4.4 4.5 4.6 
mashen01  
mashen02 
majian 

root -5.1 5.2 5.3 5.4 5.5 5.6 
mashen01  
mashen02 
majian 
Output Sample:

  rate = 24 
  start = 1 
  tracklength = 5 
  tracks = 6 
 {  
   name = tx 
   data = -1.1 -2.1 -3.1 -4.1 -5.1 
 } 
 {  
   name = ty 
   data = 1.2 2.2 3.2 4.2 5.2 
 } 
 {  
   name = tz 
   data = 1.3 2.3 3.3 4.3 5.3 
 } 
 {  
   name = rx 
   data = 1.4 2.4 3.4 4.4 5.4 
 } 
 {  
   name = rx 
   data = 1.5 2.5 3.5 4.5 5.5 
 } 
 {  
   name = rz 
   data = 1.6 2.6 3.6 4.6 5.6 
 } 
 

Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. extract data after 'root' 
(1) ctrl-o open source file 
(2) ctrl-h open replace dialog 
* fill 'search for pattern': 
 
* fill 'replace with pattern': 
 
* remove 'Print unmatched units' option 
(3) click 'Replace',data ok in 'P1' 
 
2. make transpose of data 
(1) ctrl-h open Replace dialog 
*  fill 'Replace with pattern': 
 
(2) click 'Replace', data ok in 'P2' 
 
3. process each line 
(1) ctrl-h open 'replace' dialog 
* select 'Replace Unit' to 'Line' 
* set 'Replace with Pattern' to: 
 
(2)click 'advanced' page 
* fill 'insert begin text': 
 
* fill 'run following for each matched unit': 
 
* fill 'insert end text': 
 
(3) click 'Replace', data ok in page 'P3', ctrl-s save file. 
 
Note: you can load text to page P0, run menu 'Replace->Replace by script',load 356.rst
Download Script:  scripts/356.rst.zip

Screenshot 1:  Replace_Window


Screenshot 2:  Replace_Window


Screenshot 3:  Replace_Window


Screenshot 4:  Replace_Advanced_Window


Similar Examples:
How to create a text file including filenames in a folder with specified format? (70%)
How to convert a text file to specified format? (67%)
How to change text file format with user specified rules? (67%)
How to convert the text format by user specified rules? (64%)
How to change a binary file into text file with readable hexidecimal format? (58%)
How to decorate each of marching number with specified format? (57%)
How to split each line of csv file into a single file with specified format? (57%)
How to format all the data in the text file with 8.2 format? (57%)

Check Demo of Text file parser
Keywords:
extract data  transpose  specified format  replace by script  trans  length  create  user  insert end text  insert end  extract data from text file  insert after  extract text start with and end with  transpose text  extract begin  extract begin with  remove from to end  insert data