How can I write this sed/bash command in awk or perl (or python, or ...)?
===

I need to replace instances of `Progress (n,m)` and `Progress label="some text title" (n,m)` in a scripting language with new values `(N,M)` where

    N= integer ((n/m) * normal)
    M= integer ( normal )

The progress statement can be anywhere on the script line (and worse, though not with current scripts, split across lines).

The value `normal` is a specified number between 1 and 255, and `n` and `m` are floating point numbers

So far, my `sed` implementation is below.  It only works on `Progress (n,m)` formats and not `Progress label="Title" (n,m)` formats, *but its just plain nuts*:

    #!/bin/bash
    normal=$1; 
    file=$2
    for n in $(sed -rn '/Progress/s/Progress[ \t]+\(([0-9\. \t]+),([0-9\. \t]+)\).+/\1/p' "$file" )
    do 
        m=$(sed -rn "/Progress/s/Progress[ \t]+\(${i},([0-9\. \t]+).+/\1/p" "$file")
        N=$(echo "($normal * $n)/$m" | bc)
        M=$normal
        sed -ri "/Progress/s/Progress[ \t]+\($n,$m\)/Progress ($N,$M)/" "$file"
    done

Simply put: **Is there a better way?**

My toolbox has `sed` and `bash` scripting in it, and not so much `perl`, `awk` and the like which I think this problem is more suited to.