User: basikabo -- 2014-06-28 << 1208 1210 >> |
Hits: 3023 |
Type: Advanced search and replace |
Search all Advanced search and replace examples |
Description: |
How to add different number at end according to domain name at the begin of line? 1.Extract mapping of domain names and Numbers from a.txt 2.Find the document containing the domain name 3.For the line start with a domain, add the related number at the end |
Input Sample: |
=========================== a.txt content: "http://www.google.it"|"8"|"--"|"--"|"--"|"--"|"--" "http://www.yahoo.com"|"6"|"--"|"--"|"--"|"--"|"--" get mapping: www.google.it => 8 www.yahoo.com => 6 =========================== Some text file: http://www.yahoo.com|asdkfjl| http://www.yahoo1.com|aldksfjlj| http://www.google.it|asdkfjl| ...... |
Output Sample: |
Add numbers at the end of line: http://www.yahoo.com|asdkfjl|6 http://www.yahoo1.com|aldksfjlj| http://www.google.it|asdkfjl|8 ...... |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
1. ctrl-o open a.txt 2. ctrl-h open 'replace' dialogue * set 'replace unit' to 'Line' * set 'search for pattern' to * click 'advanced' tab * set 'run following at the beginning of replace' to: * set 'run following for each matched unit' to: 3. click 'replace', and domainname/number mapping has been created in dictionary. Do not save file. 4. ctrl-h open 'replace' dialogue again * set 'replace unit' to 'Line' * set 'search for pattern' to: * set 'replace with pattern' to: 5. click 'batch ...' button open 'batch runner' window 6. drag multiple files to 'batch runner' window 7. click 'batch replace', done. Note: please make backup in advance to avoid mis-operation. |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |