| User: park -- 2011-02-27 << 726 728 >> |
| Hits: 4477 |
| Type: Advanced search and replace |
| Search all Advanced search and replace examples |
| Description: |
| How to delete just one line of one file each time and save the line-deleted file to a new name,in a loop from the maximum line to the zero line? |
| Input Sample: |
| A file,line number is m,like the below m is 5,each time delete just line and save the line-deleted file to a new file.file name is the line number__4.txt.....1.txt,0.txt. A.txt 2007/01/11,4.38,4.42,4.28,4.42,2442496 .00,0.00 2007/01/12,4.42,4.64,4.40,4.41,4820221 .00,0.00 2007/01/15,4.26,4.63,4.26,4.58,1827455 .00,0.00 2007/01/16,4.53,4.68,4.53,4.65,1550442 .00,0.00 2007/01/17,4.63,4.69,4.42,4.56,2655067 .00,0.00 |
| Output Sample: |
| 4.txt 2007/01/11,4.38,4.42,4.28,4.42,2442496 .00,0.00 2007/01/12,4.42,4.64,4.40,4.41,4820221 .00,0.00 2007/01/15,4.26,4.63,4.26,4.58,1827455 .00,0.00 2007/01/16,4.53,4.68,4.53,4.65,1550442 .00,0.00 3.txt 2007/01/11,4.38,4.42,4.28,4.42,2442496 .00,0.00 2007/01/12,4.42,4.64,4.40,4.41,4820221 .00,0.00 2007/01/15,4.26,4.63,4.26,4.58,1827455 .00,0.00 2.txt 2007/01/11,4.38,4.42,4.28,4.42,2442496 .00,0.00 2007/01/12,4.42,4.64,4.40,4.41,4820221 .00,0.00 ............ |
| Answer: |
| Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. |
| Assume the target file m.txt need to write to d:\test folder: 1. ctrl-o open source text file 2. ctrl-h open 'replace' window * click 'advanced' page, copy following code into 'Run following for each matched unit' entry: 3. click 'Replace', check folder "d:\test\", there should be files 1.txt, 2.txt,... m.txt Note: * the folder d:\test\ should be created in advance. * use double backslash in the code like d:\\test\\ |
Screenshot 1: Replace_Advanced_Window |