User: Andy -- 2013-12-15 << 1158 1160 >> |
Hits: 3935 |
Type: Text file parser |
Search all Text file parser examples |
Description: |
How to extract all data followed by specified words from many files? For example, extract format of ##.##-##.## after each Crude Soybean, or Soybean Meal R, Soybean Meal T, and so on. For each file, generate a new line with part of filename like (20131212) as first word. |
Input Sample: |
File1:MS_GR11720131212.txt ... Crude Soybean Oil 37.74- 38.49 dn 0.41 -225F to-150 F unch 46.5% Soybean Meal R 445.10- 455.10 dn 8.8 +15 F to +25 F unch 46.5% Soybean Meal T 445.10- 460.10 dn 8.8 +15 F to +30 F unch Soybean Hulls-bulk 170.00- 190.00 unch Soybean Hulls-pellets 170.00- 195.00 dn 1000-unch File2:... File3:... |
Output Sample: |
20131212 37.74 38.49 445.10 455.10 445.10 460.10 170.00 190.00 170.00 195.00 12.6975 13.0175 20.25 18.25 lines for file2... lines for file3... |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
1. open "Tools->Batch Runner" menu 2. drag multiple files from "Windows File Browser" to "Batch Runner" window 3. click "Fast Replace" button (1)click "add" to add 1st rule: * set "search" to: * set "replace" to: * click ok (2)click "add" again to add 2nd rule: * set "search" to: * set "replace" to: * click ok (3)repeat step 3(2), until all the rules are added, note that special letters(like $ % .)should be escaped(like \$ \% \.), if the format is not ##.##-##.##, you should change accordingly(follow regular exp syntax). (4)click "add" again to add next rule: * set "search" to: * set "replace" to: * click ok 4. check option of "Reg exp", "Cross Line", and "Extract" 5. click "start", and select "output to single file", done. Note: don't forget to check "Extract". |
Screenshot 1: Fast_Replace_Window |