converting one series to another

Discussion in 'Programming' started by michaelgarton, Oct 27, 2011.

  1. michaelgarton

    michaelgarton New Member

    Joined:
    Oct 27, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    I have a .txt file that reads like this:

    Name1 4-6, 72-109, 304-391
    Name2 7-93, 101-110, 143-155, 167-500
    ..etc

    I need to count the number of values across all the ranges for each name. So name1 would be:

    4-6 = 3, 72-109 = 38, 304-391 =88

    3 + 38 + 88 = 129 values in name1

    I need to carry this out on 24,000 lines, anyone recomend a simple way using awk, C, Fortran or Python?

    Thankyou
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice