User: editor -- 2010-07-07 << 557 559 >> |
Hits: 3566 |
Type: Text file parser |
Search all Text file parser examples |
Description: |
How to parse all the fields in different segment from a text file? Each segment is started with a paragraph without leading '@'. In each segment, join paragragh 8,9,10 ... together, and add a sequence number before each paragraph. |
Input Sample: |
Acadia National Park @Bar Harbor, ME U.S.A. @P.O. Box 177 Eagle Lake Rd Bar Harbor, ME 04609 U.S.A. @207-288-3338 877-444-6777 @Acadia National Park Web Site @Open Year-Round @Entry Fee Charged @Spruces, ... @other1 @other2 @others ... Snake River Birds of Prey National Conservation Area @Boise, ID U.S.A. @3948 Development Ave. Boise, ID 83705 U.S.A. @208-384-3300 Boise District Office @Snake River Birds of Prey National Conservation Area W |
Output Sample: |
1 Acadia National Park 2 Bar Harbor, ME U.S.A. 3 P.O. Box 177 Eagle Lake Rd Bar Harbor, ME 04609 U.S.A. 4 207-288-3338 877-444-6777 5 Acadia National Park Web Site 6 Open Year-Round 7 Entry Fee Charged 8 Spruces, ... other1 other2 others ... 1 Snake River Birds of Prey National Conservation Area 2 Boise, ID U.S.A. 3 3948 Development Ave. Boise, ID 83705 U.S.A. 4 208-384-3300 Boise District Office 5 Snake River Birds of Prey National Conservation Area ... |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
1. ctrl-o open source text file 2. ctrl-h open 'replace' window * set 'replace unit' to 'Paragraph' * set 'Search for pattern' to: * set 'Replace with pattern' to: * uncheck option of 'Print Unmatched Unit' click 'Advanced' page: set 'Run following for each matched unit' to: 3. click 'Replace', done! |
Download Script: scripts/558.rst.zip |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |