| User: editor -- 2010-05-19 |
| Hits: 80 |
| Type: Advanced search and replace |
| Search all Advanced search and replace examples |
| Description: |
| How to enclose all the odd number of lines with a pair of tags? I have a file containing some data, I want to add a pair of <name> </name> at the begin and end of every odd line, and leave the even line untouched, how can I achieve it? |
| Input Sample: |
| Tommy 23 Jenny 56 Mark 18 ... |
| Output Sample: |
| <name>Tommy</name> 23 <name>Jenny</name> 56 <name>Mark</name> 18 ... |
| Answer: |
| Hint: You need to Download and install "Replace Pioneer" to finish following steps. |
| 1. ctrl-o open source text file 2. ctrl-h open replace dialog * set "Replace Unit" to "Line" * set "Unit Number filter" to: Note: 1<2> means only handle line of 1,3,5,7,...(start=1, step=2, end=infinite) * set "Replace with pattern" to: 3. click "Replace", done! |
| Download Script: scripts/514.rst.zip |
Similar Examples: |
| How to reset all the numbers with format id=NNN in a text file? (55%) How to replace all the numbers in a text file to the square value? (54%) How to extract/parse all lines with number greater than 40? (54%) How to exchange the 1st and 2nd lines in each paragraph? (54%) How to remove all folders in a list containg folders and files? (53%) How to count the number of lines and characters in multiple files and make a list? (51%) How to change all negative numbers to the format of (number)? (51%) How to extract all telephone numbers from a text file? (51%) |
Check Demo of Advanced search and replace |