User: colin -- 2015-03-25 << 1289 1291 >> |
Hits: 2399 |
Type: Advanced search and replace |
Search all Advanced search and replace examples |
Description: |
I have 2 text files they both contain the same words: one word per line but broken down into separated values (file1=sounds and file2=letter combinations) So for each line in file 1 and 2 I want to check that there are equal number of separated values . ie if file1 line 1 has 5 separated values then file2 MUST have 5 values also otherwise append "FIXME-" on file2 |
Input Sample: |
file1.txt garage,g,a,r,a,ge,,,,,,,,,,,,,,,,,,,, [ e.g this has 5 separated values g a r a ge ] garaged,g,a,r,a,ge,d,,,,,,,,,,,,,,,,,,, garageman,g,a,r,a,ge,m,a,n,,,,,,,,,,,,,,,,, file2.txt garage,g,a,r,j,,,,,,,,,,,,,,,,,,,,,,,,,,,, [ e.g this has only 4 separated values g a r ge but should have 5 ] garaged,g,u,r,o,zh,d,,,,,,,,,,,,,,,,,,,,,,,,, garageman,g,u,r,o,zh,m,a,n,,,,,,,,,,,,,,,,,,,,,,, |
Output Sample: |
file2.txt FIXME-garage,g,a,r,j,,,,,,,,,,,,,,,,,,,,,,,,,,,, garaged,g,u,r,o,zh,d,,,,,,,,,,,,,,,,,,,,,,,,, garageman,g,u,r,o,zh,m,a,n,,,,,,,,,,,,,,,,,,,,,,, |
Answer: |
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
put file1.txt and file2.txt into d:\test\ folder 1. ctrl-o open file2.txt 2. ctrl-h open 'replace' dialogue * set 'replace unit' to 'Line' * set 'search for pattern' to: * set 'replace with pattern' to: * set 'if' to: * click 'advanced' tab, set 'run following at the beginning of replace' to: 3. click 'replace', done. Note: please change location of file1.txt in step 2, if your file is in other location. |
Screenshot 1: Replace_Window |
Screenshot 2: Replace_Advanced_Window |