sed or awk would work for this. I prefer sed since I already know it
This looks like you're trying to do some testing on your program which is a great idea!!
An understanding of regular expressions is important when working with these programs so if you don't know them, try to find more info on regular expressions first, then learn sed/awk.
Look at the man pages of sed or awk to see more, but here's an example of sed to get you started:
Code:
sed -r 's/B=[0-9]/B=5/' file.txt
-r turns on extended regular expressions (you don't need it here, but it is useful sometimes
's///' this is the structure of of sed expression. The string to match is between first two slashes and string to replace it with is between last two slashes
file.txt is the input file