### Replace Pioneer Home   All Examples   Free Download

RSS: Replace Pioneer Examples

# 681.Text data calculation -- How to calculate sum of every column and keep original columns?

 User: editor -- 2010-12-21          << 680  682 >> Hits: 3070 Type: Text data calculation Search all Text data calculation examples Description: How to calculate sum value of every column and keep original columns in text  file? Input Sample: Line1 AA-01 45.97 Line2 AA-02 45.00 Line3 AA-03 41.00 Line4 AA-04 40.34 Line5 AA-05 36.27 Line6 AA-06 60.09 Output Sample: Line1 AA-01 45.97 45.97 Line2 AA-02 45.00 45.00+45.97 Line3 AA-03 41.00 41.00+45.00+45.97 Line4 AA-04 40.34 40.34+41.00+45.00+45.97 Line5 AA-05 36.27 36.27+40.34+41.00+45.00+45.97 Line6 AA-06 60.09 60.09+36.27+40.34+41.00+45.00+45.97 Answer: Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps. Assume the first column is string, all other columns are numbers you need to calculate. Following procedure will keep column 1 untouched, and output the rest columns together with summary. 1. ctrl-o open source text file 2. ctrl-h open replace window * set 'replace unit' to 'Line' * set 'replace with pattern' to: \$match[1] join(' ',map{\$match[\$_]." ".\$n[\$_]}(2..\$max-1))\n * click 'Advanced' tab, set 'run following for each match unit' to: for(2..\$max-1) { \$n[\$_]+=\$match[\$_]; } 3. click 'replace', done. Screenshot 1:  Replace_Window Screenshot 2:  Replace_Advanced_Window Similar Examples: How to calculate summary of every column in a text file? (69%)How to calculate sum value of every column? (67%)How to calculate one column base on value of another column? (63%)How to calculate the summaries of every line in a txt file? (59%)How to delete the 4th column from text files with 8 columns? (58%)How to calculate the absolute average value of every 2 columns? (58%)How to calculate the total energy consumption in group? (57%)How to calculate the sum of the numbers in the same column? (57%) Check Demo of Text data calculation Keywords: summary  calculate sum  together  max  calculate  calculation  keep  first column  calcu  calculat  keep first column  keep numbers  sum columns  join columns of text  every other  first columns  join columns  calculate sum in text file