Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

651.Regular expression replace -- How to add the numbers together in every 2 adjacent lines in text file?

User: editor -- 2010-11-09          << 650  652 >>
Hits: 4775
Type: Regular expression replace   
Search all Regular expression replace examples
Description:
How to add the numbers together in every 2 adjacent lines in text file? 
There's a text file containing a number in each line, how to add the values together: line1+line2, line3+line4, line5+line6, ...
Input Sample:
11 
22 
33 
44 
..
Output Sample:
33 
77 
..
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
1. ctrl-o open source text file 
2. ctrl-h open replace window 
* fill 'search for pattern' like: 
 
* fill 'replace with pattern' like: 
 
3. click 'replace', done! 
4. ctrl-s save to file. 
 
Note: for multiple files, click "Batch..." in step 3 to open "Batch Runner" window, drag multiple files from windows to "Batch Runner" window, and click "Batch Replace", done!

Screenshot 1:  Replace_Window


Similar Examples:
How to add a page number after every 40 lines in a text file? (76%)
How to add a blank line after every 8 lines in text file? (65%)
How to delete duplicate numbers in every line in text file? (64%)
How to replace a number with another number in same text file? (64%)
How to join all odd lines together and all even lines together? (63%)
How to add sequence number for each non-blank line of a text file? (63%)
How to add line_no before each line of a text file? (63%)
How to calculate the number of days between every two adjacent dates? (61%)

Check Demo of Regular expression replace
Keywords:
adjacent lines  adjacent line  adjacent  123  together  values  containing  every  regular expression  numbers  add each line together  how to add text files together  how to add to expression together  add lines every lines  add line every lines  add line every 3 lines  add text every 2 lines  search files for numbers