13

summing over specific lines and replacing the lines with the sum

view full story
linux-howto

http://www.unix.com – Hi friends, This is sed & awk type question. It is slightly different from my previous question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers (but no more than 10 numbers in series) whenever i find it and produce an output file with the sum. For example ###start of input text file #### Code: abc def ghi 1 2 3 4 5 6 7 8 9 10 11 12 13 kjld random text occupies some 1000 3000 400 again some random text 900 100 whatever is here 900 11 what #####end of input file ######### The output should be ##start of output file #### Code: (HowTos)