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 1 root -1.1 1.2 1.3 1.4 1.5 1.6 mashen01 mashen02 majian 2 root -2.1 2.2 2.3 2.4 2.5 2.6 mashen01 mashen02 majian 3 root -3.1 3.2 3.3 3.4 3.5 3.6 mashen01 mashen02 majian 4 root -4.1 4.2 4.3 4.4 4.5 4.6 mashen01 mashen02 majian 5 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 |